feat(printer): badge print queue, Pi worker, captive-portal setup, admin printing view

- migration 20261018170000: pgmq badge_print/badge_print_dlq, print_stations,
  token-gated printer RPCs (claim/complete/fail/heartbeat), admin RPCs,
  welcome_checkin enqueue; badge_print_tests.sql (101 assertions)
- apps/printer: Python worker (Playwright render -> brother_ql via pyusb),
  comitup captive-portal (Wi-Fi + HTTPS endpoint + anon key + token),
  arm64 image build + idempotent Pi setup/install scripts, 77 pytest
- apps/admin: Printing view, station management/DLQ, global printer status
  pill, Print button on Registrations, standalone print renderer entry
  (print.html -> dist-print) with bundled fonts
- docs: printing.md + architecture/schema/rpcs/tests/admin-app updates,
  apps/printer/AGENT.md operating manual
- e2e: printing.spec.ts

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-18 22:25:38 +02:00
1 parent 0f3720d48a
commit 00c89c1b48
55 files changed
+7406 -29

No files matched your search

+23 -5
View File
@@ -49,12 +49,24 @@ flowchart LR
N -->|"proxy (supabase_kong_Convivo:8000)"| K
NA -->|"proxy (supabase_kong_Convivo:8000)"| K
SC -->|"service-role key"| K
subgraph Edge["Event venue"]
PI["Raspberry Pi print station<br/>Docker: Python worker +<br/>headless Chromium + Brother QL"]
end
PI -->|"token-gated printer RPCs<br/>(anon key + station token)"| K
P -->|"badge_print pgmq queue<br/>(enqueue on check-in)"| PI
```
The **sidecar** (`:3002`) is the one server-side component that holds the
service-role key. It is driven by the admin's **Interfaces** menu and runs on
demand only — see [backend/sidecar.md](./backend/sidecar.md).
The **Raspberry Pi print station** is the one piece of on-premise hardware:
when staff welcome-check-in an attendee, the badge is pushed onto a `pgmq`
queue in Postgres and the Pi long-polls token-gated RPCs to render and print
it. No custom backend service sits in between — see
[backend/printing.md](./backend/printing.md).
**Key idea:** there is **no custom backend**. Supabase provides auth, data,
business logic (as Postgres RPCs), and realtime. The app is a thin client that
talks to Supabase through **same-origin paths**, so there is no CORS to manage.
@@ -96,15 +108,16 @@ with **`is_admin`** or an **`@appe.at`** email. See [frontend/admin-app.md](./fr
- **Views** — Dashboard (active event + aggregates), Contacts, Registrations,
Sponsors, Schedule (slots/sessions/speakers/material), Activity (manual event
and session AI summaries), Raffle (attendee prize draws), Badges (per-event
WYSIWYG badge layout editor), Events, Interfaces,
Reports and Settings.
WYSIWYG badge layout editor), Printing (badge-print stations + queue), Events,
Interfaces, Reports and Settings.
- **Auth guard** — email-only magic links; non-admin sessions are rejected.
- **Key RPCs** — `reset_registration_qr_token` (regenerate a registration's
lanyard token + sync the Auth password), `adjust_points`, `upsert_contact`,
`create_registration`, `set_registration_type`, `set_session_material`, and the
raffle functions `get_raffle_pool` / `draw_raffle_winner` / `reset_raffle`
and the badge-layout functions `save_badge_layout` / `set_default_badge_layout`
/ `delete_badge_layout`
raffle functions `get_raffle_pool` / `draw_raffle_winner` / `reset_raffle`,
the badge-layout functions `save_badge_layout` / `set_default_badge_layout`
/ `delete_badge_layout`, and the badge-print functions
`get_print_overview` / `enqueue_badge_print` / `create_print_station`
(see [backend/rpcs.md](./backend/rpcs.md)). The deprecated AI stub is no longer
client-callable; generation uses authenticated [sidecar routes](./backend/feedback-ai.md).
@@ -209,6 +222,11 @@ Convivo/
├─ apps/sidecar/ # Sessionize sync sidecar (Node, on demand)
│ ├─ Dockerfile # node:20-alpine + xlsx (parses the Excel export)
│ └─ src/server.js # /health, /status, /run, /import-excel (blocking)
├─ apps/printer/ # Raspberry Pi badge-print worker (Python + Docker)
│ ├─ Dockerfile # repo-root context: node print-renderer stage + Playwright Chromium runtime
│ ├─ worker/ # claim → render (headless Chromium) → compose → print (Brother QL) → report
│ └─ pi/ # setup.sh / install.sh: Pi provisioning (Docker, comitup Wi-Fi portal)
│ # → backend/printing.md
├─ supabase/
│ ├─ config.toml # Local stack config (ports, auth, RLS defaults)
│ ├─ migrations/