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

@@ -117,4 +117,30 @@ public sealed class PocketBaseClientTests(PocketBaseFixture pocketBase)
faqs.Select(faq => faq.Topic?.Title).ShouldBe(["Mensa und Mittagessen", "Schließfächer"]);
faqs.ShouldAllBe(faq => !string.IsNullOrWhiteSpace(faq.Question));
}
[Fact]
public async Task Documents_load_sorted_by_order_without_drafts()
{
var client = pocketBase.CreateClient();
var documents = await client.GetDocumentsAsync();
// Seeded out of order; the draft "Internes Protokoll" must be missing.
documents.Select(document => document.Title)
.ShouldBe(["Aufnahmeantrag Förderverein", "Einzugsermächtigung", "Elternbrief"]);
documents.ShouldAllBe(document => document.File.EndsWith(".pdf", StringComparison.Ordinal));
}
[Fact]
public async Task Document_file_opens_with_the_uploaded_content()
{
var client = pocketBase.CreateClient();
var document = (await client.GetDocumentsAsync())[0];
await using var stream = await client.OpenDocumentFileAsync(document);
using var buffer = new MemoryStream();
await stream.CopyToAsync(buffer);
buffer.ToArray().ShouldBe(PocketBaseFixture.DocumentContent);
}
}