fix(audit): name automatic dose recording in medication audit rows

Switching autoMarkTaken on or off now appears in the medication.update
row with its previous value, and medication.create records whether the
medication starts with doses recorded automatically.
This commit is contained in:
Marc-André Bombeck committed 2026-10-11 15:11:27 +02:00
1 parent fe782493a1
commit 38900656a3
3 files changed
+63 -1

No files matched your search

+4
View File
@@ -1134,6 +1134,9 @@ export const PUT = apiHandler(
active: existing.active,
asNeeded: existing.asNeeded,
trackIntake: existing.trackIntake,
// v1.42.2 — switching automatic recording on or off is a change
// to how doses are recorded, so the row names it.
autoMarkTaken: existing.autoMarkTaken,
endsOn: existing.endsOn,
},
after: {
@@ -1142,6 +1145,7 @@ export const PUT = apiHandler(
active: medication.active,
asNeeded: medication.asNeeded,
trackIntake: medication.trackIntake,
autoMarkTaken: medication.autoMarkTaken,
endsOn: medication.endsOn,
},
}),
+7 -1
View File
@@ -491,7 +491,13 @@ async function postMedication(request: NextRequest): Promise<Response> {
await auditLog("medication.create", {
userId: user.id,
ipAddress: getClientIp(request),
details: { medicationId: medication.id, name },
details: {
medicationId: medication.id,
name,
// v1.42.2 — a medication created with its doses recorded
// automatically says so in its audit row.
autoMarkTaken: medication.autoMarkTaken,
},
});
annotate({