feat: finalize ticket merging and speaker-aware imports

This commit is contained in:
Lago committed 2026-10-10 13:28:18 +02:00
1 parent 648daa0794
commit 4e71e9b797
35 files changed
+1772 -348

No files matched your search

+15
View File
@@ -166,6 +166,21 @@ The Schedule view uploads a session's material to the `materials` bucket and set
button calls `evaluate_session_feedback` (the AI stub) to set
`ai_generated_feedback`.
### Registration Tickets
Registration totals and check-in totals exclude blank/missing QR tokens. Unticketed
rows remain listed separately. Check-in toggles update immediately, disable during
the request and restore their previous value on failure, without a page refresh.
**Merge tickets** appears only on QR-less Sessionize-imported registration rows.
Its modal ranks purchased tickets from the same event by matching name words,
including accent normalization, and allows searching/selecting any purchased
ticket regardless of whether its name matches. Nothing merges until confirmation.
The destination keeps its QR/email, attendance and points; session assignments and
the speaker/staff role transfer before deleting the imported registration. Contact
and Auth records and other events are preserved. Source attendee activity requires
manual reconciliation before merging. See [the RPC contract](../backend/rpcs.md).
### Delete current schedule
The Schedule view keeps the existing active-event selection pattern: it loads
+46 -1
View File
@@ -18,7 +18,7 @@ export const supabase = createClient(url, anonKey, {
- **Same-origin by default.** `VITE_SUPABASE_URL` is intentionally left unset, so
the client uses `window.location.origin`. The app is served behind a proxy
(Vite dev server, or nginx in Docker) that forwards `/auth`, `/rest`,
(Vite dev server, or nginx in Docker) that forwards `/auth/v1`, `/rest`,
`/realtime`, `/storage` to the Supabase core. This avoids CORS entirely. See
[../backend/docker.md](../backend/docker.md).
- **Anon key only.** The client is created with the **anon key** (public). The
@@ -82,6 +82,51 @@ client-side to avoid leaking other people's data:
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
in the `materials` bucket.
## Admin Email Entry
[adminEntry.ts](../../apps/convivo/src/lib/adminEntry.ts) handles email requests
and the normal app's verified session profile. Before sending, it calls the
read-only `can_request_admin_magic_link(p_email)` RPC. Eligibility requires both
an existing Auth user and a contact authorized by the existing admin rule
(`is_admin` flag or an `@appe.at` contact). Ineligible addresses do not trigger
an OTP request. Eligible addresses use `signInWithOtp` with
`shouldCreateUser: false` and
`emailRedirectTo: window.location.origin + '/auth/callback'`.
Deployment requires
[the eligibility migration](../../supabase/migrations/20261010093021_admin_magic_link_eligibility.sql)
and an Auth redirect allowlist entry for
`https://convivo.appe.at/auth/callback` (plus the corresponding URL for each
development origin). These are deployment prerequisites, not automatic frontend
configuration. Vite serves the callback as an SPA route rather than proxying it
to Auth; nginx uses an exact callback location with no access logging, no-store
caching and no-referrer policy. The document also sets no-referrer before assets
load.
The callback accepts implicit token pairs or a PKCE code exactly once per page
load, including StrictMode, and removes callback credentials from the address
bar before network calls. `getUser(access_token)` verifies identity at the Auth
server; `is_admin()` authorizes admin entry independently of editable metadata.
Failed callbacks sign out locally. Normal restored/QR sessions also verify the
user and admin role. Contact reads use the verified email; registration reads
filter by both that email and the active event, returning null when absent.
Admins need no registration or attendance state to use Convivo's existing staff
experience. This login path performs no registration, attendance or points
mutations.
Privacy boundary: the screen gives identical confirmations for eligible and
ineligible addresses and suppresses account-existence errors from OTP. However,
the public eligibility RPC returns a boolean that direct callers can inspect;
it is not enumeration-resistant. This gates this UI's sends, not direct calls
to Supabase Auth's OTP endpoint. The callback's server-backed admin check remains
the access boundary.
Mocked browser regressions are in
[convivo-admin-entry.spec.ts](../../e2e/tests/convivo-admin-entry.spec.ts);
[SQL regressions](../../supabase/tests/admin_magic_link_eligibility_tests.sql)
use rollback fixtures to check eligibility, grants and unchanged attendance
data. Neither suite sends real OTP email.
## Speaker Portal
[speakerPortal.ts](../../apps/convivo/src/lib/speakerPortal.ts) recognizes only
+23 -4
View File
@@ -52,7 +52,8 @@ uses the normal app's check-in gate. See [portal API behavior](./api-client.md#s
## Login
A 3-step flow: **splash → scan → confirm**.
A QR flow (**splash → scan → confirm**) and an admin email branch share the
same entry field.
1. **Splash** — "APPE / Break the ice. Earn the points." Tap anywhere to continue.
2. **Scan** — scan (or type) your lanyard QR. Calls `lanyardLookup(qrToken)` to
@@ -71,9 +72,27 @@ A 3-step flow: **splash → scan → confirm**.
mismatch, an error is shown ("Email and QR code do not match" for attendees,
"That password is incorrect" for staff).
> This normal QR login sends no email; the separate speaker portal uses magic links. See
> [../architecture.md#6-authentication-model](../architecture.md#6-authentication-model)
> and [../backend/rls.md](../backend/rls.md).
Entering a valid email instead of a QR requests a magic link only when the
address belongs to an existing Auth user with server-backed admin eligibility.
Whitespace and case are normalized; malformed emails show a validation error
without a QR lookup. Enter submits the field. Sending locks controls; a
successful request starts a 60-second resend cooldown, while QR entry remains
available. Eligible and ineligible addresses receive the same confirmation.
Network and rate-limit failures show a generic recoverable error.
The `/auth/callback` route verifies the Auth user and calls `is_admin()` before
admitting the session. Editable user metadata is not an authorization source.
Invalid, expired and non-admin callbacks clear the local session and return to
the entry field. Tokens/codes are scrubbed before auth calls, and callback
consumption is shared across StrictMode mounts.
Admins stay in Convivo with its existing Staff scan mode; there is no redirect
to the admin domain and no registration or physical check-in requirement for
admins. Login does not create accounts, registrations, attendance or points.
Attendee QR login retains its checked-in gate and staff QR login retains its
password confirmation. The separate speaker portal remains independent. See
[admin entry API behavior](./api-client.md#admin-email-entry) and
[authorization](../backend/rls.md).
## Home