Fixes & Refinements: QR token on registration, role caps, connection detail + red dot, admin schedule/sponsors

Datamodel:
- Move qr_token from contacts to registrations (per event); new migration
  20260826000000. lanyard_lookup / create_connection_request / checkin_attendee
  resolve via registrations + active event.
- reset_qr_token -> reset_registration_qr_token (fixes ambiguous 'email' col).
- upsert_contact drops the token arg; create_registration generates + syncs it.
- Pretix sync writes the token to the registration (keeps it on re-sync).

Registration types:
- Distinct pill colors; red reserved for Staff (both apps).
- Roles capitalized everywhere (Attendee/Speaker/Sponsor/Staff); 'Attendee'
  hidden only at the Home footer.
- Reset-token button moved from Contacts to Registrations (per registration).

Sessions (APPE Admin):
- Slot types capitalized; material submitted/not-submitted state.
- Speaker selection = multi-select search dropdown.
- Fix 'a session must have a speaker' on edit (diff-based setSessionSpeakers)
  and the file-upload bug (speaker save no longer aborts first).

APPE Admin:
- Sponsors contact lookup = search field (filter + pick).

Convivo App:
- Other people's QR codes hidden; connection detail sheet shows public info +
  points.
- Connect red dot recalculates immediately on accept/decline/send.
- 'My picks today' = 2 rows (current + next); 'tap to change' links to Agenda.

Docs updated across backend + frontend.
This commit is contained in:
Lago committed 2026-08-23 10:39:21 +02:00
1 parent 005f1d404f
commit b52d8ab007
30 files changed
+1083 -232

No files matched your search

+23 -10
View File
@@ -66,15 +66,14 @@ export async function upsertContact(input: {
full_name: string;
linkedin_url?: string | null;
is_admin?: boolean;
qr_token?: string | null;
}): Promise<Contact> {
// upsert_contact returns a single composite row (a JSON object, not an array).
// Contacts no longer carry a QR token — the token lives on the registration.
return await rpc<Contact>('upsert_contact', {
p_email: input.email,
p_full_name: input.full_name,
p_linkedin_url: input.linkedin_url ?? null,
p_is_admin: input.is_admin ?? false,
p_qr_token: input.qr_token ?? null,
});
}
@@ -86,9 +85,13 @@ export async function updateContact(
if (error) throw new ApiError(error.message);
}
/** Regenerate a contact's QR token (syncs the auth password, forces re-login). */
/**
* Regenerate the QR token of a contact's registration for the active event
* (syncs the auth password, forces re-login). The token lives on the
* registration, not the contact.
*/
export async function resetQrToken(email: string): Promise<ResetQrResult> {
const rows = await rpc<ResetQrResult[]>('reset_qr_token', { p_contact_email: email });
const rows = await rpc<ResetQrResult[]>('reset_registration_qr_token', { p_contact_email: email });
return rows[0];
}
@@ -167,13 +170,23 @@ export async function adjustPoints(contactEmail: string, delta: number, reason:
// ---- Sessions: speakers, material, AI feedback -------------------------------
export async function setSessionSpeakers(sessionId: string, emails: string[]): Promise<void> {
// Replace the speaker set: delete all, then insert the new set.
const { error: delErr } = await supabase.from('session_speakers').delete().eq('session_id', sessionId);
if (delErr) throw new ApiError(delErr.message);
// Replace the speaker set with a diff: insert the new set first, then delete
// only the speakers that are no longer in the set. Deleting first would trip
// the `session_needs_speaker` trigger (it counts the row being deleted, so
// removing the last speaker always fails) and abort the whole save.
if (emails.length > 0) {
const rows = emails.map((contact_email) => ({ session_id: sessionId, contact_email }));
const { error: insErr } = await supabase.from('session_speakers').insert(rows);
// upsert (on conflict do nothing) so re-adding an existing speaker is a no-op.
const { error: insErr } = await supabase
.from('session_speakers')
.upsert(rows, { onConflict: 'session_id,contact_email', ignoreDuplicates: true });
if (insErr) throw new ApiError(insErr.message);
const { error: delErr } = await supabase
.from('session_speakers')
.delete()
.eq('session_id', sessionId)
.not('contact_email', 'in', `(${emails.join(',')})`);
if (delErr) throw new ApiError(delErr.message);
}
}
@@ -262,8 +275,8 @@ export async function exportQrCsv(eventId: string): Promise<number> {
let count = 0;
for (const r of regs) {
const c = byEmail.get(r.contact_email);
if (!c?.qr_token) continue;
lines.push([esc(c.full_name), esc(c.email), esc(r.type), esc(c.qr_token)].join(','));
if (!r.qr_token) continue;
lines.push([esc(c?.full_name ?? r.contact_email), esc(r.contact_email), esc(r.type), esc(r.qr_token)].join(','));
count++;
}
const blob = new Blob([lines.join('\n')], { type: 'text/csv;charset=utf-8' });
+1 -1
View File
@@ -19,7 +19,6 @@ export interface Contact {
show_email: boolean;
show_linkedin: boolean;
is_admin: boolean;
qr_token: string | null;
created_at: string;
}
@@ -45,6 +44,7 @@ export interface Registration {
type: RegistrationType;
checked_in: boolean;
points: number;
qr_token: string | null;
created_at: string;
}