feat: finalize ticket merging and speaker-aware imports
This commit is contained in:
1 parent
648daa0794
commit
4e71e9b797
35 files changed
+1772
-348
No files matched your search
@@ -139,6 +139,47 @@ from `checkin_attendee`, which checks someone into a specific session).
|
||||
check-in's job).
|
||||
- `already` is `true` if the attendee was already checked in to the event.
|
||||
|
||||
### `merge_tickets(p_source_id, p_target_id)` -> `jsonb`
|
||||
|
||||
Admin-only atomic merge of an imported, QR-less speaker/staff registration into
|
||||
a purchased Pretix registration in the same event. The destination must have a
|
||||
nonempty QR token and Pretix external ID. The source must have
|
||||
`import_source = 'sessionize'`. New Excel imports record this explicitly; legacy
|
||||
QR-less speaker/staff rows with imported contact IDs and no ticket external ID
|
||||
are backfilled as Sessionize imports.
|
||||
|
||||
Locks event, registrations, contacts and session assignments. Inserts destination
|
||||
speaker links before removing source links, preserving the last-speaker invariant.
|
||||
Staff takes precedence over speaker; a destination sponsor registration adopts the
|
||||
transferred role while its separate sponsor record remains intact. Destination QR,
|
||||
email, points and attendance stay unchanged. Deletes only the source registration
|
||||
and its event leaderboard mirror, never the contact/Auth account or another event.
|
||||
Existing attendee activity on the source must be reconciled first; the RPC rejects
|
||||
it rather than losing or duplicating history. Self-merges and merge chains fail.
|
||||
|
||||
The admin-readable, RLS-protected `ticket_merges` table retains an event-scoped
|
||||
source-to-destination mapping and actor/time audit. Excel and API speaker imports
|
||||
resolve that mapping, and later Pretix role updates preserve the merged role.
|
||||
Returns source/destination registration IDs, destination email, role and the count
|
||||
of transferred session assignments. There is no implicit check-in or points award.
|
||||
|
||||
Event registration/check-in aggregates now count only nonblank QR-bearing rows;
|
||||
imported unticketed rows remain visible in Admin but do not increase ticket totals.
|
||||
|
||||
### Assigned Speaker Role
|
||||
|
||||
Registration writes resolve `attendee` to `speaker` whenever the same email has
|
||||
an assignment to a regular `session` in that registration's event. This applies
|
||||
to Pretix ticket inserts/updates, Excel imports and direct Admin changes, so a
|
||||
regular purchased ticket cannot downgrade an assigned speaker on the next sync.
|
||||
Assignments added or updated after ticket import also promote the registration.
|
||||
Staff/sponsor roles retain their existing precedence; service-session links and
|
||||
links in other events do not promote attendees. Unassigned attendees remain
|
||||
attendees. The migration reconciles existing assigned attendees without changing
|
||||
QR tokens, ticket identifiers, attendance, points or session links. Assignments
|
||||
use exact contact email, not fuzzy name matches; different emails require the
|
||||
explicit ticket merge workflow above.
|
||||
|
||||
### `submit_feedback(p_session_id, p_rating, p_comment)` → `(feedback_id, points, earned)`
|
||||
Post-session feedback.
|
||||
- **Requires the caller to be checked in** to that session (else raises).
|
||||
|
||||
+13
-9
@@ -20,15 +20,20 @@ Bootcamp (Austria)** — instead of random demo data:
|
||||
|
||||
| Data | Count | Notes |
|
||||
|---|---|---|
|
||||
| `auth.users` + `auth.identities` | 54 | 50 attendees + 4 staff; **QR token = bcrypt password** (attendees), **`appe-admin-2026`** (staff) |
|
||||
| `contacts` | 54 | 50 attendees + 4 staff (`is_admin = true`, `password = 'appe-admin-2026'`) |
|
||||
| `auth.users` + `auth.identities` | 4 | Staff only; **`appe-admin-2026`** (staff password) |
|
||||
| `contacts` | 4 | Staff only (`is_admin = true`, `password = 'appe-admin-2026'`) |
|
||||
| `events` | 1 | **Global Power Platform Bootcamp \| Austrian Power Platform Enthusiasts Edition**, 2026-02-20, Vienna, Austria, **active**, `sessionize_endpoint` set to `https://sessionize.com/api/v2/4domszaq/view/All` |
|
||||
| `registrations` | 54 | 50 `attendee` + 4 `staff`; each with a `CVV-XXX-NNNN` QR token |
|
||||
| `registrations` | 4 | Staff only; each with a staff QR token |
|
||||
| `slots` | 10 | 2026-02-20, 09:15–17:00 (7 `session` + 3 `service_session`) |
|
||||
| `sessions` | 22 | real titles/descriptions/rooms from the Sessionize API |
|
||||
| `session_speakers` | 0 | **added by the Excel import** (not seeded) |
|
||||
| `sponsors` | 0 | none for this event |
|
||||
|
||||
No synthetic attendees or artificial starting points are seeded. Attendee
|
||||
registrations come from purchased Pretix tickets. Removing fixtures from the seed
|
||||
does not delete accounts already present in a database; do not reset a live
|
||||
database to apply this change.
|
||||
|
||||
> **Speaker contacts are intentionally absent.** After `db:reset`, run the Excel
|
||||
> import (Interfaces → Import Excel → choose the `.xlsx` → Import) to add the 21
|
||||
> speakers: their contacts, session links, and `speaker` registrations.
|
||||
@@ -86,17 +91,16 @@ trigger).
|
||||
| **Sabrina Hota** | staff (admin) | sabrina@appe.at | `appe-admin-2026` |
|
||||
| **Jose Lago** | staff (admin) | jose@appe.at | `appe-admin-2026` |
|
||||
| **Markus Franz** | staff (admin) | markus@appe.at | `appe-admin-2026` |
|
||||
| 50 attendees | attendee | (made-up, e.g. lena.huber@gmail.com) | QR `CVV-ATT-1000`…`CVV-ATT-1049` |
|
||||
|
||||
> **Speaker auto-promote:** the Excel import creates the speakers' registrations
|
||||
> as `speaker` directly (and the `session_speakers_speaker_promote` trigger
|
||||
> promotes any `attendee` that gets linked). The seed itself contains **no
|
||||
> speakers** — only the 50 attendees and 4 staff.
|
||||
> speakers** — only the 4 staff.
|
||||
|
||||
## Suggested demo flow
|
||||
|
||||
1. Log in as **Amelia** (staff/admin) in the admin app (`[email protected]` /
|
||||
`appe-admin-2026`) → Dashboard shows the real event (54 registrations, 22
|
||||
1. Log in as **Amelia** (staff/admin) in the admin app using an email magic link
|
||||
for `[email protected]` → Dashboard shows the real event (4 registrations, 22
|
||||
sessions).
|
||||
2. **Interfaces → Import Excel** → choose the "Sessions and speakers
|
||||
(advanced)" `.xlsx` → **Import** → the result modal shows the speakers
|
||||
@@ -105,5 +109,5 @@ trigger).
|
||||
sessions list their speakers.
|
||||
4. **Events** → the event's **Sessionize endpoint** is set; the **Sync** button
|
||||
runs the (keyless) API sync.
|
||||
5. Log in as an **attendee** in the Convivo app (QR `CVV-ATT-1000` +
|
||||
`[email protected]`) → Home/Agenda show the real agenda.
|
||||
5. Sync purchased tickets from Pretix, then log in as an **attendee** in the
|
||||
Convivo app using their ticket QR and email → Home/Agenda show the real agenda.
|
||||
+42
-1
@@ -54,7 +54,48 @@ contacts + registrations.
|
||||
Excel rows are grouped by **Session Id** into one session with all distinct
|
||||
speaker emails; repeated speakers are emitted once by email. Separate session
|
||||
and speaker sheets take precedence over a combined sheet if both are present.
|
||||
Sessions without a title, ID, or scheduled time are skipped as before.
|
||||
Talks without a title, ID, or scheduled time are skipped. Service entries still
|
||||
require a nonempty title and a positive numeric Excel scheduled time, but may
|
||||
omit their **Session Id**.
|
||||
|
||||
### Services omitted from the accepted-session export
|
||||
|
||||
The flattened accepted-session export can omit schedule-only services entirely.
|
||||
The supplied 2026-10-09 export was checked read-only: one sheet, 25 rows, 23
|
||||
scheduled rows, 21 importable sessions and **zero service entries**. Its two
|
||||
excluded scheduled rows have IDs but blank titles and formats; they cannot be
|
||||
identified as breaks or placeholders. None of the depicted Arrival & Coffee,
|
||||
Opening Keynote, breaks, Lunch, Coffee or Placeholder entries is recoverable
|
||||
from this workbook. The importer does not invent titles or fill schedule gaps.
|
||||
|
||||
Use the existing **API sync** with an endpoint that actually includes these
|
||||
service entries, or add their real schedule data to a sheet named **Service
|
||||
sessions** (trimmed and case-insensitive) in the uploaded workbook. This explicit
|
||||
sheet is imported alongside either accepted-session format, or on its own. Its
|
||||
rows are always service sessions; no Session Format is required:
|
||||
|
||||
| Header | Value |
|
||||
|---|---|
|
||||
| Title | Required actual service title |
|
||||
| Scheduled At | Required Excel date/time cell (numeric serial, not a date string) |
|
||||
| Scheduled Duration | Duration in minutes; blank defaults to zero |
|
||||
| Room | Optional room name |
|
||||
| Session Id | Optional stable source ID; prefer the actual Sessionize ID when available |
|
||||
| Description | Optional description |
|
||||
|
||||
Alternatively, service rows in the accepted-session sheet can omit Session Id
|
||||
when **Session Format** matches `service`, `break`, `lunch`, `closing` or
|
||||
`plenum`. Titles alone do not classify services: a talk mentioning coffee is
|
||||
not automatically converted.
|
||||
|
||||
For ID-less services, the external ID is `excel-service:` plus a SHA-256 digest
|
||||
of the trimmed title, trimmed room, normalized date and start time. Duplicate
|
||||
rows merge and repeated imports retain the same identity regardless of row
|
||||
order, duration or description edits. Changing title, room, date or start time
|
||||
changes that identity; supply a stable Session Id for entries that may be
|
||||
renamed or rescheduled. Use the same actual source ID across Excel and API
|
||||
imports to avoid two identities for the same service. Services use the existing
|
||||
RPC's service-slot typing and staff assignment; no database migration is needed.
|
||||
|
||||
Topic classification uses the first nonempty value of **Themenfeld / Area of
|
||||
Topic**, **Area**, then **Topic**. Headers are trimmed and matched
|
||||
|
||||
@@ -82,7 +82,7 @@ npx supabase status
|
||||
| `[auth.rate_limit] email_sent` | `100` | Project-wide hourly budget when using custom SMTP; not an entitlement to provider capacity |
|
||||
| `[auth.email] max_frequency` | `60s` | Minimum resend interval, matching the Admin UI cooldown |
|
||||
| `[auth.email] otp_expiry` | `3600` | Magic links expire after one hour and are single-use |
|
||||
| `[auth.email.smtp] enabled` | `true` | Explicit local opt-in to real outbound MXroute email, not Mailpit capture |
|
||||
| `[auth.email.smtp] enabled` | `true` | Explicit local opt-in to real outbound Brevo email, not Mailpit capture |
|
||||
| `[auth.email.smtp] pass` | `env(CONVIVO_SMTP_PASSWORD)` | Password loaded from a private runtime environment, never committed |
|
||||
| `[db.seed] sql_paths` | `["./seed.sql"]` | Seed runs on reset |
|
||||
|
||||
@@ -101,12 +101,19 @@ Hosts, schemes, ports and paths must match; there are no wildcard redirects.
|
||||
For an alternate dev port, explicitly allow its callback URL before testing
|
||||
real email links. Mocked browser tests do not exercise the Auth allowlist.
|
||||
|
||||
Local Auth explicitly opts into **real outbound email** through MXroute:
|
||||
`heracles.mxrouting.net:465`, SMTP user and From address `convivo@lago.dev`,
|
||||
sender name `Convivo APP`. GoTrue's mail transport selects implicit TLS for
|
||||
port 465 and verifies the server certificate; no insecure TLS override is used.
|
||||
The committed configuration opts into **real outbound email** through Brevo:
|
||||
`smtp-relay.brevo.com:587`, From address `info@convivo.appe.at`, sender name
|
||||
`Convivo APP`. The provider-specific SMTP login is configured separately from
|
||||
the From address. Transport uses STARTTLS with certificate verification;
|
||||
no insecure TLS override is used.
|
||||
Mailpit remains available but does not capture these externally delivered emails.
|
||||
|
||||
Production switched to Brevo on 2026-10-10. The local private credential was
|
||||
aligned, but a configuration edit alone does not restart an existing local Auth
|
||||
container. See [the deployment record](../releases/2026-10-10.md) for activation
|
||||
and verification boundaries. The 2026-10-07 notes below describe the earlier
|
||||
MXroute activation, not the current production provider.
|
||||
|
||||
The password is referenced only as `env(CONVIVO_SMTP_PASSWORD)`. On this machine,
|
||||
it is provisioned in the git-ignored `supabase/.env`, with owner-only permissions
|
||||
(`0600`). Supabase CLI **2.115.0** loads dotenv files starting in `supabase/`
|
||||
|
||||
+40
-1
@@ -6,6 +6,31 @@ Supabase Postgres container.
|
||||
|
||||
## Run it
|
||||
|
||||
Assigned-speaker/Pretix role regression tests (rollback-only):
|
||||
|
||||
```bash
|
||||
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/migrations/20261010111607_preserve_assigned_speaker_role.sql supabase/tests/assigned_speaker_role_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
|
||||
```
|
||||
|
||||
Covers purchased attendee tickets becoming assigned speakers, assignment before
|
||||
ticket creation, repeated Pretix updates, Excel/Pretix replay, assignment updates,
|
||||
staff/sponsor precedence, service-session exclusion and other-event isolation.
|
||||
QR, ticket ID, check-in and points are preserved.
|
||||
|
||||
Ticket merge regression tests (rollback-only, including prior date-guard functions
|
||||
when the local database has not installed that migration):
|
||||
|
||||
```bash
|
||||
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/tests/registration_ticket_merge_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
|
||||
CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- registration-ticket-merge.spec.ts --project=chromium
|
||||
```
|
||||
|
||||
Coverage includes ticket-only totals, authorization, cross-event isolation,
|
||||
last-speaker-safe transfers, duplicate assignments, staff precedence, retained
|
||||
ticket points/QR/check-in, source activity rejection, import provenance and
|
||||
Excel/API replay. Browser tests cover immediate check-in feedback and failure
|
||||
rollback, imported-only merge buttons, suggestions, manual choice, cancel/retry.
|
||||
|
||||
```bash
|
||||
npm run db:start # the Supabase core must be running
|
||||
npm run test:rpc # runs supabase/tests/rpc_tests.sql, exits non-zero on failure
|
||||
@@ -149,7 +174,21 @@ matching, nonempty Area/Topic fallback, complete comma-separated topic strings,
|
||||
flattened multi-speaker session grouping, duplicate speaker IDs/emails, singular
|
||||
Speaker Id fallback, legacy two-sheet plural Speaker Ids, scheduled time and
|
||||
metadata preservation, service-session classification, and unscheduled-row
|
||||
filtering. See [supported Excel formats](./sidecar.md#what-it-does).
|
||||
filtering. Generated XLSX service regressions also cover an explicit service
|
||||
sheet alongside flattened talks, a service-only workbook, missing-ID service
|
||||
classification, duplicate service rows, stable generated IDs across repeated
|
||||
parses and row reordering, unchanged IDs after duration/description edits,
|
||||
distinct identities by title/room/date/start, preservation of explicit source
|
||||
IDs, and exclusion of untitled, invalid-time and ID-less talk rows. See
|
||||
[service export limitations and accepted service format](./sidecar.md#services-omitted-from-the-accepted-session-export).
|
||||
|
||||
Read-only validation of the supplied 2026-10-09 workbook compared its complete
|
||||
parsed payload against the committed parser: unchanged 21 sessions, 24 speakers,
|
||||
21 speaker links and zero service sessions. Parsing twice produced identical
|
||||
payloads. No HTTP import or database writes were performed. Parser repeatability
|
||||
and the existing RPC external-ID upsert contract support idempotent imports;
|
||||
these database-free checks do not verify a live import or prove that any
|
||||
configured API endpoint includes the services missing from Excel.
|
||||
|
||||
## Files
|
||||
|
||||
|
||||
Reference in new issue
Block a user