Expand schemas.md into a full platform backend schema pack
Cover shared envelopes/events, Admin ops DTOs, B2B portal entities, and Ecom retail shapes so one pack backs all Gishen backend sheets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
80e8197539
commit
065423efbf
|
|
@ -39,7 +39,7 @@ Demo password for all accounts: `demo123`
|
|||
|
||||
- **Cross-app master:** [`docs/GISHEN-MASTER-SPEC.md`](docs/GISHEN-MASTER-SPEC.md) — Admin / Mob / Ecom / B2B surface map, shared domain objects, auth providers, divergence notes. **Refresh before `git push`** (Cursor rule + optional `.githooks/pre-push`).
|
||||
- **Admin backend contract:** [`docs/admin-backend-spec.md`](docs/admin-backend-spec.md) — updated whenever Admin modules are finalized.
|
||||
- **Entity schemas:** [`docs/schemas.md`](docs/schemas.md) — TypeScript + field tables for main domain elements (Money, Org, Rx, Order, Item, Stock, …).
|
||||
- **Entity schemas:** [`docs/schemas.md`](docs/schemas.md) — platform schema pack (shared + Admin + B2B + Ecom/backend).
|
||||
|
||||
```bash
|
||||
# One-time: enable in-repo pre-push reminder for this clone
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
| Date | Change |
|
||||
| --- | --- |
|
||||
| 2026-08-08 | **Entity schemas (platform pack):** Expanded [`docs/schemas.md`](./schemas.md) to cover shared primitives, Admin ops backend DTOs, B2B portal entities, Ecom/retail DTOs, event catalog, and path-prefix ownership. §2.9 index updated. |
|
||||
| 2026-08-08 | **Entity schemas:** Added shared schema summary (§2.9) + link to Admin [`docs/schemas.md`](./schemas.md) for full field tables on Money, Staff, Org/Commercial, Doctor, Rx, Order, Item/UOM, Stock, Customer, Settlement, Dispatch. |
|
||||
| 2026-08-08 | **Org/Money alignment:** Canonical org status `pending_activation`; Admin activate path + `CommercialTerms`/`Money`; B2B register `POST /v1/org/register` + `org.activated`/`org.suspended`. Resolved Money default (decimal major ETB). Refreshed divergence table + Sources stamp after sibling B2B/Ecom skim. |
|
||||
| 2026-08-07 | **Seed batch:** Created master spec from Admin living contract + sibling Mob/Ecom/B2B/Dispatch sheets. Documented product surface map, shared domain objects (auth, orgs, doctors, orders/guest, Rx dosing, catalogue multi-UOM + PDP, stock, loyalty), auth provider matrix, divergence & sync notes, deeper-doc links, Sources stamp, and pre-push update rule. Wired `.cursor/rules` + optional `.githooks/pre-push` reminder. Linked from Admin `README.md` and `admin-backend-spec.md`. |
|
||||
|
|
@ -185,22 +186,22 @@ Admin helper: `src/lib/dosingSchedule.ts`.
|
|||
|
||||
### 2.9 Shared schema index (main elements)
|
||||
|
||||
Canonical **field-level schemas** live in Admin: [`docs/schemas.md`](./schemas.md).
|
||||
Do not invent a third shape here — change the Admin schema pack + sibling entity docs together.
|
||||
Canonical **field-level schemas** live in Admin: [`docs/schemas.md`](./schemas.md) (**platform pack** — shared + Admin + B2B + Ecom).
|
||||
Do not invent a third shape here — change the schema pack + owning sibling sheet together.
|
||||
|
||||
| Element | Canonical TypeScript (summary) | Full schema |
|
||||
| --- | --- | --- |
|
||||
| **Money** | `{ amount: string; currency: 'ETB' }` | [schemas § Money](./schemas.md#money) |
|
||||
| **CommercialTerms** | `credit_limit` / `credit_used` Money + payment terms + price list + contract dates | [§ Organisation](./schemas.md#organisation--commercialterms) |
|
||||
| **OrgStatus** | `pending_activation \| active \| suspended \| closed \| rejected` | same |
|
||||
| **StaffUser** | `id`, `email`, `role: StaffRole`, optional `branchId`, `preferredLocale`, `authProvider` | [§ StaffUser](./schemas.md#staffuser) |
|
||||
| **Doctor** | Hospital/clinic-scoped clinician; not a `StaffRole` | [§ Doctor](./schemas.md#doctor) |
|
||||
| **PrescriptionItem** | `name`, `qty`, `frequency?`, `intervalHours?`, `times?: HH:mm[]` | [§ Prescription](./schemas.md#prescription) |
|
||||
| **Order** | `customerType?: registered\|guest`, `customerPhone?`, `fulfillment`, `paid`, optional `doctorId`/`orgId` | [§ Order](./schemas.md#order) |
|
||||
| **MedicationItem** | Catalogue master + `uoms[]` with `conversionFactor` into `baseUnit` | [§ Item](./schemas.md#medicationitem--itemuom) |
|
||||
| **StockRow** | Branch × SKU × batch qty (+ `itemId`, `erpQty`) | [§ StockRow](./schemas.md#stockrow) |
|
||||
| **Customer** | Shared `customer_id`, loyalty tier/points | [§ Customer](./schemas.md#customer) |
|
||||
| **DomainEvent** | `id`, `type`, `occurred_at`, `org_id?`, `actor_id?`, `payload`, `schema_version` | [§ Envelopes](./schemas.md#api-envelopes) |
|
||||
| **Money** | `{ amount: string; currency: 'ETB' }` | [§1](./schemas.md#1-shared-primitives) |
|
||||
| **DomainEvent** | `id`, `type`, `occurred_at`, `org_id?`, `actor_id?`, `payload`, `schema_version` | [§2](./schemas.md#2-api-envelopes--domain-events) |
|
||||
| **StaffUser / Doctor / SessionUser / Customer** | Distinct principals | [§3](./schemas.md#3-principals--actors) |
|
||||
| **CommercialTerms / OrgStatus** | Admin writes; B2B reads | [§4](./schemas.md#4-admin--organisations--doctors) |
|
||||
| **PrescriptionItem** | `frequency?`, `times?: HH:mm[]` | [§5](./schemas.md#5-admin--prescriptions--orders) |
|
||||
| **Order** | `customerType`, guest phone, doctor/org optional | [§5](./schemas.md#5-admin--prescriptions--orders) |
|
||||
| **MedicationItem / StockRow** | Catalogue + branch inventory | [§6](./schemas.md#6-admin--catalogue-stock--procurement) |
|
||||
| **POS / Loyalty / Campaign** | Counter + CRM growth | [§7](./schemas.md#7-admin--pos-crm-loyalty--marketing) |
|
||||
| **Member / Package / Department** | B2B portal | [§9](./schemas.md#9-b2b-portal-schemas) |
|
||||
| **SpendLine / Statement / EntitlementQuote** | B2B finance + Ecom checkout | [§10](./schemas.md#10-b2b-finance-migration--rx-views) · [§11](./schemas.md#11-ecom--retail-schemas) |
|
||||
| **Backend path ownership** | `/admin/*` vs `/v1/*` vs retail | [§12](./schemas.md#12-backend-ownership--path-prefixes) |
|
||||
|
||||
```ts
|
||||
// Platform Money (Admin + B2B agreement)
|
||||
|
|
@ -270,7 +271,7 @@ Accurate as of **2026-08-08** skim. Prefer fixing sheets over inventing a third
|
|||
| Doc | Purpose |
|
||||
| --- | --- |
|
||||
| [`docs/admin-backend-spec.md`](./admin-backend-spec.md) | Living Admin API/UI contract (primary depth) |
|
||||
| [`docs/schemas.md`](./schemas.md) | **Entity schemas** — Money, Org, Rx, Order, Item, Stock, … |
|
||||
| [`docs/schemas.md`](./schemas.md) | **Platform schema pack** — shared + Admin + B2B + Ecom/backend DTOs |
|
||||
| [`README.md`](../README.md) | Runbook, demo accounts, deploy |
|
||||
| `src/lib/dosingSchedule.ts` | Frequency → default times helpers |
|
||||
| `src/config/navigation.ts` | Page registry |
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
| Date | Change |
|
||||
| --- | --- |
|
||||
| 2026-08-08 | **Entity schemas pack:** [`schemas.md`](./schemas.md) for main domain elements; linked from Conventions + master |
|
||||
| 2026-08-08 | **Entity schemas pack (platform):** [`schemas.md`](./schemas.md) covers shared + Admin + B2B + Ecom/backend DTOs; linked from Conventions + master |
|
||||
| 2026-08-08 | **B2B org alignment:** `pending_activation`, `POST .../activate` + `CommercialTerms`/`Money`, events `org.activated`/`org.suspended`; B2B register path `POST /v1/org/register` |
|
||||
| 2026-08-07 | Pointer to cross-app [`GISHEN-MASTER-SPEC.md`](./GISHEN-MASTER-SPEC.md) + pre-push refresh rule |
|
||||
| 2026-08-06 | Scaffold: conventions, roles, auth, empty module sections |
|
||||
|
|
@ -63,19 +63,21 @@
|
|||
|
||||
### Entity schemas (setup)
|
||||
|
||||
Full schemas for the main domain objects live in **[`schemas.md`](./schemas.md)** (TypeScript interfaces + field tables + samples). Keep that file in sync with `src/types/index.ts`, `src/mocks/catalog.ts`, and `src/mocks/data.ts`.
|
||||
Full **platform** schemas (shared primitives, Admin ops, B2B portal, Ecom/retail, events) live in **[`schemas.md`](./schemas.md)**. Keep that file in sync with Admin mocks/types, B2B `docs/backend/entities/`, and Ecom `docs/backend.md`.
|
||||
|
||||
| Element | Schema anchor |
|
||||
| Area | Schema anchors |
|
||||
| --- | --- |
|
||||
| Money / envelopes / events | [`schemas.md#money`](./schemas.md#money) · [envelopes](./schemas.md#api-envelopes) |
|
||||
| StaffUser · Branch | [`#staffuser`](./schemas.md#staffuser) · [`#branch`](./schemas.md#branch) |
|
||||
| Organisation · CommercialTerms | [`#organisation--commercialterms`](./schemas.md#organisation--commercialterms) |
|
||||
| Doctor | [`#doctor`](./schemas.md#doctor) |
|
||||
| Prescription · dosing lines | [`#prescription`](./schemas.md#prescription) |
|
||||
| Order · guest/registered | [`#order`](./schemas.md#order) |
|
||||
| MedicationItem · ItemUom | [`#medicationitem--itemuom`](./schemas.md#medicationitem--itemuom) |
|
||||
| StockRow · Customer · Settlement | [`#stockrow`](./schemas.md#stockrow) · [`#customer`](./schemas.md#customer) · [`#settlement`](./schemas.md#settlement) |
|
||||
| RiderTrip · MigrationJob | [`#rider--ridertrip`](./schemas.md#rider--ridertrip) · [`#migrationjob`](./schemas.md#migrationjob) |
|
||||
| Shared Money / envelopes / events | [§1–2](./schemas.md#1-shared-primitives) |
|
||||
| Principals (Staff, Doctor, B2B session, Customer) | [§3](./schemas.md#3-principals--actors) |
|
||||
| Org · Commercial · Branch · Doctor | [§4](./schemas.md#4-admin--organisations--doctors) |
|
||||
| Rx · Order | [§5](./schemas.md#5-admin--prescriptions--orders) |
|
||||
| Catalogue · Stock · Procurement | [§6](./schemas.md#6-admin--catalogue-stock--procurement) |
|
||||
| POS · Loyalty · Marketing · FAQ | [§7](./schemas.md#7-admin--pos-crm-loyalty--marketing) |
|
||||
| Settlements · Dispatch · Admin imports · Audit | [§8](./schemas.md#8-admin--finance-dispatch-imports--audit) |
|
||||
| B2B registration · Member · Package · Dept | [§9](./schemas.md#9-b2b-portal-schemas) |
|
||||
| B2B Finance · tenant Migration · Rx views | [§10](./schemas.md#10-b2b-finance-migration--rx-views) |
|
||||
| Ecom catalog · order create · entitlement · KYC · payments | [§11](./schemas.md#11-ecom--retail-schemas) |
|
||||
| Path-prefix ownership map | [§12](./schemas.md#12-backend-ownership--path-prefixes) |
|
||||
|
||||
#### Quick reference — Money & Org (canonical)
|
||||
|
||||
|
|
|
|||
1149
docs/schemas.md
1149
docs/schemas.md
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user