Point the docs at the split admin schema files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:49:36 -05:00
parent e4a9c96f7e
commit f94f1a6584
2 changed files with 9 additions and 9 deletions

View file

@ -71,7 +71,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
## Admin CRUD engine
Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema.js` (server) and `adminSchema.ts` (client) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema.js` (server) and `src/lib/adminSchema/` (client, one file per entity, registered in `adminSchema.ts`) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
- Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere.
- `reindex: false` prevents cross-entity sort order collisions.
- The `OMIT` sentinel distinguishes unsent fields from deliberate clears.

View file

@ -49,7 +49,7 @@ each entity:
| File | What it holds |
| ----------------------------- | ----------------------------------------------------- |
| `src/lib/adminSchema.ts` | The **form**: field labels, help text, dropdown labels, list columns and filters |
| `src/lib/adminSchema/` (one file per entity, `shared.ts` for common fields; `src/lib/adminSchema.ts` lists them) | The **form**: field labels, help text, dropdown labels, list columns and filters |
| `server/src/admin-schema.js` | What the server **accepts**: columns, types, the allowed values of each `enumeration(...)` |
And the database itself holds the final word: most fixed lists are a
@ -76,7 +76,7 @@ organization name in the label, as the `awards` query does.
> are changed with a migration: `UPDATE event_scopes SET name = '…' WHERE id = '…';`
**2. A fixed list in code (`options`).** The choices are written in
`src/lib/adminSchema.ts`. Each option is one of two shapes:
the entity's file in `src/lib/adminSchema/`. Each option is one of two shapes:
```ts
options: ["speaker", "leader", "host"] // shows: speaker, leader, host
@ -90,7 +90,7 @@ relabelling cheap.
### Renaming what a dropdown shows
If the stored value stays the same and you only want the dropdown to
read differently, **only `src/lib/adminSchema.ts` changes**. No
read differently, **only the file in `src/lib/adminSchema/` changes**. No
migration, no server change, and every existing row keeps working.
Find the field (search for its column name) and give the option a
@ -147,7 +147,7 @@ together, in one branch:
decide what existing rows become first.
2. **`server/src/admin-schema.js`**: the `enumeration("column", [...])`
list for that column.
3. **`src/lib/adminSchema.ts`**: the `options` on the form field, and on
3. **`src/lib/adminSchema/<entity>.ts`**: the `options` on the form field, and on
the list filter if there is one.
4. **Anywhere the public site renders or relies on the value**, listed in
the table below (for example `EVENT_TYPES` for event types, or the
@ -160,7 +160,7 @@ wrong rather than working around it.
### Every dropdown in the editor
**Fixed lists** (`options`: labels in `src/lib/adminSchema.ts`, values
**Fixed lists** (`options`: labels in `src/lib/adminSchema/`, values
also in `admin-schema.js` and a CHECK):
| Entity → field | Stored values | Labelled? | Also used on the public site by |
@ -176,7 +176,7 @@ also in `admin-schema.js` and a CHECK):
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema.ts`). |
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
@ -219,7 +219,7 @@ each is changed in a different place:
| --- | --- |
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. |
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema/frontPage.ts` |
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
To rename a band **for visitors**, use the admin. To rename how it
@ -253,7 +253,7 @@ CHECK on `front_page_sections.section` via a migration.
The numbers band's "Number Source" dropdown works the same way:
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema.ts`.
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/frontPage.ts`.
- **Change what a count counts:** its query in `STAT_QUERIES` in
`server/src/routes/home.js`. Keep it counting exactly what the
matching public page shows (published rows), or the number and the