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
This commit is contained in:
1 parent
04f3f55b78
commit
c980effddc
55 files changed
+7406
-29
No files matched your search
@@ -303,6 +303,37 @@ Interfaces view's "recent runs").
|
||||
(`sync_runs_select_admin`). Written only by the `sync_sessionize_event` /
|
||||
`sync_sessionize_excel` RPCs.
|
||||
|
||||
## `print_stations` — badge printer stations
|
||||
|
||||
One row per Raspberry Pi print station. Added by
|
||||
[`20261018170000_badge_print_queue.sql`](../../supabase/migrations/20261018170000_badge_print_queue.sql)
|
||||
together with the badge-print queues — the full model (tokens, states, RPCs)
|
||||
is in [printing.md](./printing.md).
|
||||
|
||||
| Column | Type | Notes |
|
||||
|---|---|---|
|
||||
| `id` | `uuid` PK | `gen_random_uuid()` |
|
||||
| `name` | `text` | non-blank; renamed via `rename_print_station`, shown to the worker through the heartbeat response |
|
||||
| `token_hash` | `text` **unique** | the **SHA-256 hex digest** of the station's `cvp_…` bearer token — the plaintext is shown once at creation and never stored |
|
||||
| `created_at` | `timestamptz` | |
|
||||
| `revoked_at` | `timestamptz` | nullable — set by `revoke_print_station`; the token stops working immediately |
|
||||
| `last_seen_at` | `timestamptz` | stamped by every printer RPC; > 45 s old ⇒ state `offline` |
|
||||
| `last_status` | `jsonb` | the latest heartbeat blob (printer / network / worker), capped at 16 KB |
|
||||
|
||||
**RLS enabled with no policies** and no grants to `anon` / `authenticated` —
|
||||
every access goes through the `security definer` RPCs (admin:
|
||||
`get_print_overview` & friends; printer: the token-gated `printer_*` functions).
|
||||
|
||||
### pgmq queues (`badge_print`, `badge_print_dlq`)
|
||||
|
||||
The `pgmq` extension holds the badge-print job queue and its dead-letter queue.
|
||||
Queue rows live in the **`pgmq` schema** (`pgmq.q_badge_print`,
|
||||
`pgmq.a_badge_print` for completed/archived jobs, `pgmq.q_badge_print_dlq`),
|
||||
not in `public`. The schema, tables, sequences and functions are revoked from
|
||||
`public` / `anon` / `authenticated`: the API never exposes queue contents —
|
||||
enqueuing, claiming, completing and dead-lettering all go through the RPCs in
|
||||
[printing.md](./printing.md#4-rpcs).
|
||||
|
||||
## Other indexes
|
||||
|
||||
- `slots_event_id_idx (event_id)`, `registrations_event_id_idx (event_id)`,
|
||||
|
||||
Reference in new issue
Block a user