Remove the leftover file content layer and align the docs

This commit is contained in:
tleininger committed 2026-09-23 15:30:53 +02:00
1 parent 3fd3796d73
commit 47d9841532
21 files changed
+154 -327

No files matched your search

+29
View File
@@ -100,3 +100,32 @@ The app reads its content from PocketBase over the compose network
inside the compose network, independent of the container name). Editing content
means editing records in the PocketBase admin UI at
<http://localhost:8090/_/>, not editing files. See `redaktion.md`.
---
## Adding a new content type
Editors can add **records** to the existing collections and add plain text
`pages`, but a **new kind of list** — its own collection rendered on its own
route with its own sorting or grouping — is a development task, not editorial.
It takes three steps, all small because the plumbing is shared:
1. **Collection + DTO.** Create the collection in the PocketBase admin (give it a
`public` bool and open List/View rules, like the others), then add a matching
record type in `Elternbeirat.Contracts` with `[JsonPropertyName(...)]` on each
field — mirror `Page`/`Post`.
2. **Client method.** Add one method to `PocketBaseClient`. The shared
`GetRecordsAsync<T>(collection, sort, ct)` already does the `public=true`
filter, the sort and the deserialization, so a new type is a one-liner:
`public Task<IReadOnlyList<Minutes>> GetMinutesAsync(CancellationToken ct = default)`
`=> GetRecordsAsync<Minutes>("minutes", "-date", ct);`
3. **Feature component.** Add a component under `Features/<Name>/` with its own
`@page "/…"` route that injects `PocketBaseClient`, calls the new method and
renders the result. Literal routes win over the `/{Slug}` catch-all, so pick a
slug that no `pages` record needs. Follow an existing list (`PostList`,
`EventList`, `FaqList`) for the load-in-`OnInitializedAsync`, log-and-degrade
pattern, and add a route smoke test plus a fixture seed.
Text pages need none of this — they are all served generically by
`ContentPage` (`@page "/{Slug}"`), which is why a new `pages` record is live
without a rebuild.