mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
`POST /api/admin/notifications/reminder-check` walked every active medication on the instance and dispatched a reminder for each overdue slot it found. That is the operator button's intended behaviour and it stays the default, but it left any other caller — a browser journey, a smoke check — writing into every account's delivery ledger at once with no way to say otherwise. The body now accepts an optional `userId` that narrows the sweep. It can only narrow: the route is `requireAdmin()`, cookie-only by construction, so a Bearer caller never reaches it however wide its scope, and the selector feeds the Prisma `where` rather than the authorisation. A bodyless POST — what the admin panel sends — is unchanged. An unknown key is a 422 instead of a silently instance-wide run. Published in the contract alongside the notification diagnostic, so the scope is readable rather than folded into the console-only exemption.
2.4 MiB
2.4 MiB