mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
- rung 2: a prefilled, user-confirmed, editable, declinable prompt writes an ordinary VORSORGE reminder keyed on the dose's primary antigen; the published origin enum and reminder DTO are unchanged - idempotent by antigen — a second confirmation re-anchors the existing reminder rather than minting a second (WR-9 seen red on the reminder count, reverted by content hash) - rolling day cadence so logging the next dose re-anchors the due date through the Phase 1 satisfy matcher; the whole loop proven through real routes - booster prompt copy in six locales, plural-aware
52 lines
2.7 KiB
TypeScript
52 lines
2.7 KiB
TypeScript
/**
|
|
* Query keys — the immunization log.
|
|
* Part of the centralized factory; aggregated in `./index.ts`.
|
|
*
|
|
* These exist before any client reads them, because the in-repo
|
|
* `healthlog/queryKey-factory` rule errors on a bare array: the first
|
|
* component that lists doses cannot compile without a slot here. Same key with
|
|
* a different `queryFn` shape silently poisons the cache, which is the whole
|
|
* reason the factory is the only legal source.
|
|
*
|
|
* There is deliberately no matching `invalidateUserVaccinations` in
|
|
* `src/lib/cache/invalidate.ts`, for the same reason the visits module next
|
|
* door has none. That module evicts SERVER-side cached payloads, and no cached
|
|
* payload reads a dose: the dashboard snapshot, the insights targets and the
|
|
* analytics buckets are computed from measurements, medications and mood.
|
|
* Adding a sweep over caches nothing reads would be a placeholder that looks
|
|
* like coverage. It belongs in the release that puts doses into one of those
|
|
* payloads, alongside the reader that makes it necessary.
|
|
*
|
|
* There is no dependent-keys bundle here yet either, and that omission is the
|
|
* same rule one layer up: a bundle with no caller is dead code, and the gate
|
|
* says so. When the capture surface lands it brings its own, and that bundle
|
|
* has to evict the preventive-care root alongside this one — logging a dose
|
|
* satisfies the booster reminders it answers, so the checkups list goes stale
|
|
* in the same tick. Evicting only the immunization list would leave a booster
|
|
* on screen that the server had already moved a decade out.
|
|
*/
|
|
export const vaccinationKeys = {
|
|
/**
|
|
* The root prefix every dose write invalidates through
|
|
* (`vaccinationDependentKeys` in `./index.ts`). TanStack's hierarchical
|
|
* prefix semantics mean evicting `["vaccinations"]` clears the list and
|
|
* every open detail in one tick, so a dose edited in a sheet and the list
|
|
* behind it never disagree.
|
|
*/
|
|
vaccinations: () => ["vaccinations"] as const,
|
|
/**
|
|
* The list. The filter is part of the key: a page showing one antigen's
|
|
* history and the page showing everything are two different answers rather
|
|
* than one answer that overwrites the other.
|
|
*/
|
|
vaccinationList: (antigenSlug?: string | null) =>
|
|
["vaccinations", "list", antigenSlug ?? null] as const,
|
|
vaccination: (id: string) => ["vaccinations", "detail", id] as const,
|
|
/** Mutation keys — the factory is the only legal source of these too. */
|
|
vaccinationCreate: () => ["vaccinations", "create"] as const,
|
|
vaccinationUpdate: () => ["vaccinations", "update"] as const,
|
|
vaccinationDelete: () => ["vaccinations", "delete"] as const,
|
|
vaccinationRestore: () => ["vaccinations", "restore"] as const,
|
|
vaccinationBooster: () => ["vaccinations", "booster"] as const,
|
|
} as const;
|