Files
temetro/frontend/lib/activity.ts
T
Khalid Abdi 3ee00fcf06 feat: per-patient record history + summary PDF export
Add GET /api/activity/patient/:fileNumber (every audited change on one chart,
newest first, readable by any clinic member) and surface it as a Record
history timeline in the patient detail sheet. Add a Download summary action
that builds a clean, printable one-page clinical summary in the browser
(Save as PDF) — no PDF dependency, nothing leaves the server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 21:33:31 +03:00

37 lines
1016 B
TypeScript

import { apiFetch } from "@/lib/api-client";
// An audit-log entry. Mirrors the backend `src/types/activity.ts`. A plain,
// tamper-evident trail of record changes in the active clinic. (The signing /
// patient-approval vision is separate and not built yet.)
export type ActivityEntityType =
| "patient"
| "note"
| "appointment"
| "prescription"
| "task";
export type ActivityEntry = {
id: string;
actorName: string;
actorInitials: string;
action: string;
entityType: ActivityEntityType;
entityId: string | null;
patientName: string | null;
patientFileNumber: string | null;
createdAt: string;
};
export function listActivity(): Promise<ActivityEntry[]> {
return apiFetch<ActivityEntry[]>("/api/activity");
}
// A single patient's record history (every clinician's adds/changes on it).
export function listPatientActivity(
fileNumber: string,
): Promise<ActivityEntry[]> {
return apiFetch<ActivityEntry[]>(
`/api/activity/patient/${encodeURIComponent(fileNumber)}`,
);
}