Files
HealthLog/src/app/api
Marc-André Bombeck 54ad5cdb69 refactor(medications): extract shared today-intake projection helper
Both `/api/medications/intake?scope=today` and `/api/dashboard/summary`
carried their own copy of the v1.4.39 projection + idempotent
`createMany` + per-`(med, day)` compliance recompute. The duplicate
implementations had already drifted twice; fold them into one tested
location at `src/lib/medications/scheduling/project-today-intakes.ts`
so future changes (new IntakeSource literal, new schedule cadence,
audit metadata) only land once.

The helper stays read-shape-neutral — the two routes return different
projections of the resulting events, so the caller still owns its
typed re-read. Returns `{ projected, backfilled }` for the existing
`annotate` telemetry.

Net: ~200 lines collapsed into 145 (helper) + two short call sites.
2026-05-21 17:52:01 +02:00
..
2026-05-16 14:19:57 +02:00
2026-05-16 03:17:00 +02:00
2026-05-14 23:49:32 +02:00
2026-05-14 23:49:32 +02:00
2026-05-12 22:33:35 +02:00
2026-05-16 12:37:55 +02:00
2026-05-17 23:46:09 +02:00
2026-05-16 09:28:40 +02:00
2026-05-14 23:49:32 +02:00