mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
Add the `/api/allergies` and `/api/family-history` endpoints (list / create / read / update / soft-delete), each wrapped in `apiHandler` with Zod `safeParse` + `returnAllZodIssues`. `userId` is always narrowed from the session/Bearer — never a body field — and the Prisma `data` is built field-by-field (no mass assignment). Creates wrap in `withIdempotency`. The free-text reaction/note are encrypted before write and decrypted fail-soft on read via the server-authoritative DTOs. Register the query-key factory entries and the OpenAPI route tables (new `Records` tag); regenerate `docs/api/openapi.yaml`.
18 lines
744 B
TypeScript
18 lines
744 B
TypeScript
/**
|
|
* Query keys — allergies (v1.25, W-RECORDS). The allergy list + a single
|
|
* allergy read. Part of the centralized factory; aggregated in `./index.ts`.
|
|
*/
|
|
export const allergyKeys = {
|
|
/**
|
|
* `allergies()` is the root prefix every allergy write invalidates through.
|
|
* `allergyList(includeInactive)` keys the list (the inactive toggle is part
|
|
* of the key so the two response sets cache distinctly). Any allergy write
|
|
* evicts the whole `["allergies"]` prefix so the list + open sheet repaint
|
|
* in lockstep.
|
|
*/
|
|
allergies: () => ["allergies"] as const,
|
|
allergyList: (includeInactive: boolean) =>
|
|
["allergies", "list", includeInactive] as const,
|
|
allergy: (id: string) => ["allergies", "detail", id] as const,
|
|
};
|