mirror of
https://github.com/temetro/temetro.git
synced 2026-08-30 12:19:07 +00:00
backend: prescription start/end dates + dispense ledger
Add optional startDate/endDate columns to prescriptions (schema, validation, types, service) — when set, endDate drives expiry. Add a new append-only `dispenses` resource (schema, types, validation, service, route at /api/dispenses) recording who received which medication, gated on the existing inventory RBAC statement. Migration 0020. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,11 @@ export const prescriptions = pgTable(
|
||||
frequency: text("frequency").notNull(),
|
||||
prescriber: text("prescriber").notNull(),
|
||||
prescribedAt: date("prescribed_at").defaultNow().notNull(),
|
||||
// Optional explicit course window. When set, `endDate` drives expiry instead
|
||||
// of parsing the free-text `duration`. Both are opt-in (the dialog reveals
|
||||
// them behind a toggle), so they stay nullable.
|
||||
startDate: date("start_date"),
|
||||
endDate: date("end_date"),
|
||||
status: text("status").$type<PrescriptionStatus>().notNull(),
|
||||
duration: text("duration"),
|
||||
notes: text("notes"),
|
||||
|
||||
Reference in New Issue
Block a user