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:
Lago committed 2026-10-18 22:25:38 +02:00
1 parent 04f3f55b78
commit c980effddc
55 files changed
+7406 -29

No files matched your search

+32
View File
@@ -16,6 +16,7 @@ import type {
PointsLogRow,
PretixOptions,
PretixSyncResult,
PrintOverview,
RafflePoolEntry,
RaffleWinner,
Registration,
@@ -491,3 +492,34 @@ export const generateFeedbackSummary = (eventId: string, sessionId?: string) =>
method: 'POST',
body: JSON.stringify({ event_id: eventId, scope: sessionId ? 'session' : 'event', ...(sessionId ? { session_id: sessionId } : {}) }),
});
// ---- Badge printing (queue + printer stations) -------------------------------
/** Admin dashboard snapshot: stations, queue counters, recent jobs, dead letters. */
export const getPrintOverview = () => rpc<PrintOverview>('get_print_overview', {});
/** Queue one attendee's badge for printing; resolves with the queue msg id. */
export const enqueueBadgePrint = (registrationId: string) =>
rpc<number>('enqueue_badge_print', { p_registration_id: registrationId });
/** Register a printer station. The token is returned only here, never again. */
export async function createPrintStation(name: string): Promise<{ id: string; token: string }> {
// create_print_station returns a one-row table (a JSON array of one object).
const rows = await rpc<{ id: string; token: string }[]>('create_print_station', { p_name: name });
if (!rows[0]) throw new ApiError('Station creation returned no token');
return rows[0];
}
/** Retire a station; its token stops working immediately. */
export const revokePrintStation = (id: string) => rpc<void>('revoke_print_station', { p_id: id });
/** Rename a station (revoked ones included); the Pi adopts the new name. */
export const renamePrintStation = (id: string, name: string) =>
rpc<void>('rename_print_station', { p_id: id, p_name: name });
/** Push a dead letter back onto the live queue; resolves with the new msg id. */
export const requeueDeadBadgePrint = (msgId: number) =>
rpc<number>('requeue_dead_badge_print', { p_msg_id: msgId });
/** Drop a dead letter without retrying it. */
export const discardDeadBadgePrint = (msgId: number) => rpc<void>('discard_dead_badge_print', { p_msg_id: msgId });