mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
feat(medications): add status filter to GET /api/medications/[id]/intake
Extend the list endpoint with an optional `status` query knob — `all` (default), `taken`, `skipped`, `completed` — so the detail-page intake history can hide unconfirmed rows server-side without changing the byte-stable contract the iOS Swift client and the existing dashboard tiles depend on. `completed` (taken OR skipped) covers the detail-page surface; `taken` / `skipped` are there for any future single-arm consumer. Co-located route test pins the Prisma where fragment per branch and the 422 on unknown values.
This commit is contained in:
1 parent
79a1b4fbc6
commit
a0af8c7208
3 files changed
+207
-3
No files matched your search
@@ -89,6 +89,24 @@ export const listIntakeEventsSchema = z.object({
|
||||
.optional()
|
||||
.default("scheduledFor"),
|
||||
sortDir: z.enum(["asc", "desc"]).optional().default("desc"),
|
||||
/**
|
||||
* v1.4.37 W3 — server-side status filter so the medication detail
|
||||
* page (IntakeHistoryListV2) can hide unconfirmed / planned rows.
|
||||
*
|
||||
* - "all" (default): every event, preserves the byte-stable contract
|
||||
* the iOS Swift client and existing dashboard consumers depend on.
|
||||
* - "taken": only rows where the dose was confirmed taken
|
||||
* (`takenAt IS NOT NULL AND skipped = false`).
|
||||
* - "skipped": only rows the user explicitly skipped (`skipped = true`).
|
||||
* - "completed": taken OR skipped — anything the user actually
|
||||
* actioned. Excludes the ambiguous "missed / never confirmed"
|
||||
* rows (`takenAt IS NULL AND skipped = false`) that the v1 list
|
||||
* rendered as "verpasst" before the v1 component retired.
|
||||
*/
|
||||
status: z
|
||||
.enum(["all", "taken", "skipped", "completed"])
|
||||
.optional()
|
||||
.default("all"),
|
||||
});
|
||||
|
||||
export const updateIntakeEventSchema = z.object({
|
||||
|
||||
Reference in new issue
Block a user