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
This commit is contained in:
1 parent
1bffae9777
commit
1cbbd1b529
16 files changed
+730
-142
No files matched your search
@@ -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);
|
||||
}
|
||||
@@ -159,6 +159,13 @@ export interface CheckinResult {
|
||||
already: boolean;
|
||||
}
|
||||
|
||||
/** Result of a staff welcome check-in (marks an attendee present at the event). */
|
||||
export interface WelcomeCheckinResult {
|
||||
attendee_email: string;
|
||||
attendee_name: string;
|
||||
already: boolean;
|
||||
}
|
||||
|
||||
export interface FeedbackResult {
|
||||
feedback_id: string;
|
||||
points: number;
|
||||
|
||||
Reference in new issue
Block a user