Serve downloadable PDFs from a PocketBase documents collection

- New collection "documents" (title, slug, file, category, order, public);
  editors upload PDFs in the admin, no developer or redeploy needed
- The app serves each file at /dokumente/<slug>.pdf, a URL that survives a
  new upload (PocketBase's own file name gets a random suffix)
- New "documents" embed lists them as file cards, grouped by category;
  /downloads uses it
- List/view rules are "public = true", so a draft PDF is not reachable through
  the PocketBase API either
- Dev seed adds example documents with generated PDFs and fixes the
  const reassignment that broke seeding a fresh volume
- Docs: editor guide, architecture, and the manual production setup steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-10-12 22:15:18 +02:00
1 parent 97321e2b49
commit f1a06956f7
18 files changed
+641 -31

No files matched your search

+29 -1
View File
@@ -213,6 +213,33 @@ when the runner is down. It does not deploy.
---
## Schema changes in production
Production is never seeded from the repo, so a new collection or field that a
release depends on is set up by hand in the production admin
(`redaktion.elternbeirat-igmh.info/_/`) — **before** merging the release, because
the app reads the new collection as soon as it is live. A missing collection only
degrades (the embed stays empty, the route answers 503), it does not break pages.
The repo's `pb/pb_migrations/collections_schema.json` is the reference for what
production should look like. Current one-time steps:
**`documents` (downloads):**
1. *Settings → Import collections*, paste a JSON array holding **only** the
`documents` object from `collections_schema.json`, keep the merge option on so
the review lists **no** collection to delete, then confirm.
2. *Collections → pages → Edit collection* → field `embed`: add the value
`documents`, set *Max select* to 3, save the field **and** the collection.
3. On the `downloads` page record: set `embed` to `documents` and cut the
hard-coded PDF list out of its body (the links pointed to files that never
existed in the image).
4. Upload the PDFs as `documents` records (see `redaktion.md`, *Dokumente*).
Uploaded files live in `pb_data/storage`, so the `pb_data` backup (#9) covers them.
---
## The compose files
`compose.yaml` is the **production** base; the workflow deploys it to Unraid as
@@ -245,7 +272,8 @@ answers every **page** request with the static `wwwroot/maintenance.html`:
| `/health` | **503** `PocketBase unreachable` (for Uptime Kuma) |
| `/events.ics` | 200 with an empty calendar, so subscriptions keep working |
| `/events/{id}.ics` | 503 |
| Static files (CSS, fonts, PDFs, `/maintenance.html`) | served as usual |
| `/dokumente/{slug}.pdf` | 503 (the file lives in PocketBase) |
| Static files (CSS, fonts, `/maintenance.html`) | served as usual |
The gate caches the health check for **10 seconds** (`PocketBaseHealthCache`). So
after PocketBase stops, pages can render for up to 10 s more (the components