mirror of
https://github.com/temetro/temetro.git
synced 2026-08-13 03:56:53 +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:
@@ -8,6 +8,7 @@ export type ActivityEntityType =
|
||||
| "prescription"
|
||||
| "invoice"
|
||||
| "inventory"
|
||||
| "dispense"
|
||||
| "task";
|
||||
|
||||
export type ActivityEntry = {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// The canonical Dispense shape returned by the API. Mirrors the frontend
|
||||
// `lib/dispenses.ts` Dispense type. Scoped to the active clinic; patient and
|
||||
// dispenser fields are denormalized for display.
|
||||
export type Dispense = {
|
||||
id: string;
|
||||
fileNumber: string;
|
||||
name: string;
|
||||
initials: string;
|
||||
medication: string;
|
||||
dose: string;
|
||||
quantity: number;
|
||||
unit: string;
|
||||
prescriptionId: string | null;
|
||||
dispensedBy: string | null;
|
||||
dispensedByName: string;
|
||||
dispensedAt: string; // ISO timestamp
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
};
|
||||
@@ -13,6 +13,8 @@ export type Prescription = {
|
||||
frequency: string;
|
||||
prescriber: string;
|
||||
prescribedAt: string; // YYYY-MM-DD
|
||||
startDate: string | null; // YYYY-MM-DD, optional course start
|
||||
endDate: string | null; // YYYY-MM-DD, optional course end (drives expiry)
|
||||
status: PrescriptionStatus;
|
||||
duration: string | null;
|
||||
notes: string | null;
|
||||
|
||||
Reference in New Issue
Block a user