frontend phase 13

This commit is contained in:
hamid
2026-07-10 16:58:15 +03:30
parent 6186f54294
commit 85488bc25b
57 changed files with 3283 additions and 105 deletions
@@ -0,0 +1,36 @@
/**
* When true, the patient-records domain is served by the in-memory mock (`apis/mockApi.ts`) behind the
* `PatientRecordsApi` seam.
*
* **Mock is primary this phase.** b14 serves the nurse-authored **visit-note history** (`care_records`
* GET/POST) — those two methods are real — but the **family-owned editable record** (medications/routine/
* tasks) and the **access check** have **no backend at all** (neither the contract nor the data model has
* them; **REQ-027**). The mock seeds a default family record + a multi-nurse continuity history per patient,
* enforces a foreign-patient **access-denied** (403) path, and lets the nurse append notes that appear in the
* history. Flip to `false` once REQ-027 lands — only `clientApi.ts`'s family-record/access methods flip; the
* history/append methods already map the real routes.
*/
export const USE_PATIENT_RECORDS_MOCK = true;
/** Page size for the longitudinal visit-note history (api-conventions `pageSize`). */
export const RECORD_HISTORY_PAGE_SIZE = 10;
/**
* The family record + history move slowly (a customer edit / a per-visit note), so a modest `staleTime` means
* tab-switching never refetches; mutations invalidate the affected key. The access check is effectively
* static per session — keep it warm longer.
*/
export const FAMILY_RECORD_STALE_TIME = 60 * 1000;
export const RECORD_HISTORY_STALE_TIME = 60 * 1000;
export const RECORD_ACCESS_STALE_TIME = 5 * 60 * 1000;
export const PATIENT_RECORDS_GC_TIME = 10 * 60 * 1000;
/** Wire cap on a visit-note body (`WriteCareRecordBody.body` ≤ 8000). */
export const VISIT_NOTE_MAX_LENGTH = 8000;
/**
* A sentinel patient id the mock treats as **not owned** by the caller, so the E2 access-denied card is
* demoable by navigating to `/patients/8888/record`. On the real path this state comes from a `403` on the
* clinical read; there is no such thing as a "foreign patient id" on the wire.
*/
export const MOCK_FOREIGN_PATIENT_ID = 8888;