mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
36461a5498
Patient record: - Add `bloodType` and `phone` to the patient model (schema, canonical types on both backend + frontend, zod validation). `phone` is a demographic field (reception can read/write); `bloodType` is clinical PHI, redacted for the reception role. Surface both in the record sheet, chat summary card, and the add/edit patient form. Migration 0033. Clinic location: - New org-scoped `clinic_settings` table (address/city/country + optional lat/long), service, and routes: GET /api/clinic/settings (any clinician) and PUT /api/clinic/location (owner/admin). Edited in Settings → Signing → Clinic location. Consumed later by the wallet app. Migration 0034. i18n: - Translate all new keys into every shipped locale (en/de/fr/ar/so) and document the "translate into every locale" rule in frontend/CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
1012 B
TypeScript
34 lines
1012 B
TypeScript
// Client for clinic-level (organization) settings — currently the clinic's
|
|
// location (Settings → Signing → Location). Calls the backend over the shared
|
|
// fetch wrapper (session cookie sent automatically).
|
|
|
|
import { apiFetch } from "@/lib/api-client";
|
|
|
|
export type ClinicLocation = {
|
|
address: string;
|
|
city: string;
|
|
country: string;
|
|
latitude: number | null;
|
|
longitude: number | null;
|
|
};
|
|
|
|
export type ClinicSettings = {
|
|
location: ClinicLocation;
|
|
};
|
|
|
|
// The clinic's settings. Readable by any clinician; returns empty defaults when
|
|
// nothing has been set yet.
|
|
export async function getClinicSettings(): Promise<ClinicSettings> {
|
|
return apiFetch<ClinicSettings>("/api/clinic/settings");
|
|
}
|
|
|
|
// Save the clinic's location (owner/admin only). Returns the updated settings.
|
|
export async function saveClinicLocation(
|
|
location: ClinicLocation,
|
|
): Promise<ClinicSettings> {
|
|
return apiFetch<ClinicSettings>("/api/clinic/location", {
|
|
method: "PUT",
|
|
body: JSON.stringify(location),
|
|
});
|
|
}
|