Registration optionset + speaker auto-promote + welcome check-in

- registrations.type is now a Postgres ENUM (registration_type)
- session_speakers trigger auto-promotes attendee -> speaker (never overrides staff/sponsor)
- new welcome_checkin RPC: staff marks an attendee present at the event
- admin Registrations: QR token is final (no reset); failed sponsor change opens in-place sponsor lookup
- Convivo Home: Now/Next cards always render; red pending-material pill + popup for speakers
- Convivo Agenda: speakers can delete their material to re-upload
- Convivo Scan: staff Session/Welcome check-in toggle (uiverse switch)
- seed: staff (Bruno/Rita) get a password so staff QR login works after reset

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-08-23 21:33:44 +02:00
1 parent adcbb507e9
commit ffb270c140
16 files changed
+730 -142

No files matched your search

+24
View File
@@ -14,6 +14,7 @@ import type {
Registration,
Session,
Slot,
WelcomeCheckinResult,
} from './types';
export class ApiError extends Error {}
@@ -157,6 +158,12 @@ export async function checkinAttendee(sessionId: string, attendeeQr: string): Pr
return rows[0];
}
/** Staff welcome check-in: mark an attendee present at the event (no session). */
export async function welcomeCheckin(attendeeQr: string): Promise<WelcomeCheckinResult> {
const rows = await rpc<WelcomeCheckinResult[]>('welcome_checkin', { p_attendee_qr: attendeeQr });
return rows[0];
}
export async function getMyFeedback(email: string): Promise<Feedback[]> {
const { data, error } = await supabase.from('feedback').select('*').eq('contact_email', email);
if (error) throw new ApiError(error.message);
@@ -212,3 +219,20 @@ export async function uploadSessionMaterial(sessionId: string, file: File): Prom
if (dbErr) throw new ApiError(dbErr.message);
return path;
}
/** Remove a session's material (storage object + clear material_path). Speakers
* can delete their own material to re-upload; the path is cleared via the
* `set_session_material` RPC (sessions is admin-write only). */
export async function removeSessionMaterial(sessionId: string): Promise<void> {
const { data } = await supabase.from('sessions').select('material_path').eq('id', sessionId).maybeSingle();
const path = (data as Session | null)?.material_path;
if (path) {
const { error: rmErr } = await supabase.storage.from('materials').remove([path]);
if (rmErr) throw new ApiError(rmErr.message);
}
const { error: dbErr } = await supabase.rpc('set_session_material', {
p_session_id: sessionId,
p_material_path: null,
});
if (dbErr) throw new ApiError(dbErr.message);
}