mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
merge: W3 labs biomarker list + hidden flag into v1.22
This commit is contained in:
commit
37bfd7bb4e
16 files changed
+193
-78
No files matched your search
@@ -30,7 +30,7 @@ createBiomarkerSchema.meta({
|
||||
updateBiomarkerSchema.meta({
|
||||
id: "UpdateBiomarkerRequest",
|
||||
description:
|
||||
"Partial edit of a biomarker. An omitted key leaves the column untouched; an explicit `null` on `context` / `panel` / a bound clears it. A rename that collides with another of the caller's markers is rejected 409.",
|
||||
"Partial edit of a biomarker. An omitted key leaves the column untouched; an explicit `null` on `context` / `panel` / a bound clears it. Set `hidden` to drop / restore the marker in the active list + lab-entry pickers. A rename that collides with another of the caller's markers is rejected 409.",
|
||||
});
|
||||
|
||||
const biomarkerRow = z
|
||||
@@ -43,13 +43,14 @@ const biomarkerRow = z
|
||||
panel: z.string().nullable(),
|
||||
hasContext: z.boolean(),
|
||||
context: z.string().nullable(),
|
||||
hidden: z.boolean(),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
})
|
||||
.meta({
|
||||
id: "Biomarker",
|
||||
description:
|
||||
"A user-scoped catalog marker. `context` is the decrypted per-marker note (or null); `hasContext` flags its presence. A `LabResult` linking this marker resolves its unit + reference bounds from here.",
|
||||
"A user-scoped catalog marker. `context` is the decrypted per-marker note (or null); `hasContext` flags its presence. `hidden` drops the marker from the active catalog list and the lab-entry pickers without deleting it (its readings and unit/range survive). A `LabResult` linking this marker resolves its unit + reference bounds from here.",
|
||||
});
|
||||
|
||||
const listResponse = z
|
||||
|
||||
@@ -72,4 +72,21 @@ describe("updateBiomarkerSchema", () => {
|
||||
});
|
||||
expect(r.success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts a hidden toggle", () => {
|
||||
const r = updateBiomarkerSchema.safeParse({ hidden: true });
|
||||
expect(r.success).toBe(true);
|
||||
if (r.success) expect(r.data.hidden).toBe(true);
|
||||
});
|
||||
|
||||
it("leaves hidden undefined when omitted", () => {
|
||||
const r = updateBiomarkerSchema.safeParse({ unit: "mmol/L" });
|
||||
expect(r.success).toBe(true);
|
||||
if (r.success) expect(r.data.hidden).toBeUndefined();
|
||||
});
|
||||
|
||||
it("rejects a non-boolean hidden", () => {
|
||||
const r = updateBiomarkerSchema.safeParse({ hidden: "yes" });
|
||||
expect(r.success).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -72,6 +72,9 @@ export const updateBiomarkerSchema = z
|
||||
upperBound: upperBound.or(z.null()),
|
||||
context: optionalContext.or(z.null()),
|
||||
panel: optionalPanel.or(z.null()),
|
||||
// v1.22 — hide / unhide a marker. An omitted key leaves visibility
|
||||
// untouched; `true` drops the marker from the active list + pickers.
|
||||
hidden: z.boolean().optional(),
|
||||
})
|
||||
.refine(
|
||||
(d) =>
|
||||
|
||||
Reference in new issue
Block a user