feat: T4 waves 1-2 - rule configs, schema, suggestions core, season, rule forms
- Rule configs with typed parsers and registry; Berlin day helpers - Schema: T4 enums, Suggestion table, feed vocabulary (feedStatus as ColonyCondition with legacy text mapping), split queen source, varroa sample size; migration harness for data migrations - SuggestionsService: propose/refresh/resolve/obsolete/expire, accept/dismiss/reopen incl. bulk, lock order, concurrency e2e - SeasonService: phenology-based segments, inspection/varroa due dates, queen age; TimeEventsStep with JobPartialFailure - Frontend: per-rule settings forms with visible value sources Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
7097fcd97c
commit
d99a697739
116 files changed
+11239
-801
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { bool, intIn, makeParser } from './parse-helpers';
|
||||
import type { ChainConfig } from './rule-config.types';
|
||||
|
||||
const MAX_DUE_IN_DAYS = 365;
|
||||
|
||||
/** Follow-up chains (queen cells, queen acceptance): one check some days later. */
|
||||
export function chainParser(trigger: string, defaults: ChainConfig) {
|
||||
return makeParser<ChainConfig>(trigger, defaults, (scope) => ({
|
||||
dueInDays: intIn(
|
||||
scope,
|
||||
'dueInDays',
|
||||
defaults.dueInDays,
|
||||
0,
|
||||
MAX_DUE_IN_DAYS,
|
||||
),
|
||||
notify: bool(scope, 'notify', defaults.notify),
|
||||
}));
|
||||
}
|
||||
|
||||
export const DEFAULT_CHAIN_CONFIG: ChainConfig = {
|
||||
dueInDays: 7,
|
||||
notify: false,
|
||||
};
|
||||
|
||||
export const DEFAULT_WITHDRAWAL_ENDED_CONFIG = { notify: true };
|
||||
|
||||
export const withdrawalEndedParser = makeParser<{ notify: boolean }>(
|
||||
'WITHDRAWAL_ENDED',
|
||||
DEFAULT_WITHDRAWAL_ENDED_CONFIG,
|
||||
(scope) => ({
|
||||
notify: bool(scope, 'notify', DEFAULT_WITHDRAWAL_ENDED_CONFIG.notify),
|
||||
}),
|
||||
);
|
||||
|
||||
/** The cleanup rule has no setting; it is only switched on or off. */
|
||||
export const colonyEndedCleanupParser = makeParser<Record<string, never>>(
|
||||
'COLONY_ENDED_CLEANUP',
|
||||
{},
|
||||
() => ({}),
|
||||
);
|
||||
Reference in new issue
Block a user