mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
Add a user-scoped Biomarker catalog so a marker is defined once — name, unit, lower/upper bound, optional encrypted context, panel — and every later reading just links it. New /api/biomarkers CRUD plus a structured /api/labs create path: a biomarkerId resolves the unit + reference range server-side, so the list and detail DTOs carry the resolved values and the client never recomputes the range. Lab reads include the linked marker and fall back to the legacy free-text fields for unlinked rows. Add a lab-result restore endpoint for the delete-Undo affordance, a shared serialiser, a static common-panel seed list, and tests for catalog validation, structured-entry resolution, and the context codec.
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/**
|
|
* v1.17.1 — TanStack Query keys for the structured lab-result store.
|
|
*
|
|
* `labResultsList` bakes the filter + pagination shape into the key so a
|
|
* filter change refetches without a same-key cache collision (the project's
|
|
* queryKey-factory invariant).
|
|
*/
|
|
export const labKeys = {
|
|
labResults: () => ["lab-results"] as const,
|
|
|
|
labResultsList: (params: {
|
|
biomarkerId?: string | undefined;
|
|
analyte: string | undefined;
|
|
panel: string | undefined;
|
|
from: string | undefined;
|
|
to: string | undefined;
|
|
page: number;
|
|
sortDir: string;
|
|
}) =>
|
|
[
|
|
"lab-results",
|
|
"list",
|
|
params.biomarkerId ?? null,
|
|
params.analyte ?? null,
|
|
params.panel ?? null,
|
|
params.from ?? null,
|
|
params.to ?? null,
|
|
params.page,
|
|
params.sortDir,
|
|
] as const,
|
|
|
|
// v1.18.1 — user-scoped Biomarker catalog. The list feeds the picker and
|
|
// the manager; both invalidate `biomarkers()` after a mutation.
|
|
biomarkers: () => ["biomarkers"] as const,
|
|
biomarkerDetail: (id: string) => ["biomarkers", "detail", id] as const,
|
|
};
|