Volunteer rosters: roles, sign-ups, swaps, QR check-in, kids-room duty (backend)

Serving roles per event or session, sign-ups and assigning with an overlap
check, swaps that happen on accept (notify recipients emailed), QR and manual
check-in (kids-room roles start rostered duty), optional free volunteer ticket,
day-before reminder job, hours served, privacy hooks. The kids check-in and
volunteer tickets are left out of public event pages and public registration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 03:59:52 +02:00
co-authored by Claude Opus 5.5
parent a4fc2c0a88
commit a9f13a1b0a
16 changed files with 1494 additions and 7 deletions
+11 -2
View File
@@ -460,7 +460,10 @@ async function anonymiseUser(userId, db = prisma) {
const { familyDeleted } = await require('./kids').removeFromFamily(tx, userId);
await tx.kidsCheckIn.updateMany({ where: { checkedOutById: userId }, data: { checkedOutById: null } });
return { attendees: attendeeIds.length, formAnswers: answers.count, providerRecords: txns.length + checkouts.length, familyDeleted };
// Volunteer rosters: shifts still to come are given up; past ones stay for hours served.
const shiftsGivenUp = await require('./volunteers').forgetVolunteer(tx, userId);
return { attendees: attendeeIds.length, formAnswers: answers.count, providerRecords: txns.length + checkouts.length, familyDeleted, shiftsGivenUp };
});
await clearTrustedDevices(userId);
@@ -482,7 +485,7 @@ async function exportUserData(userId, db = prisma) {
});
if (!user) return null;
const [registrations, payments, tickets, waitlist, certificates, feedback, consents, security, requests, notices, family] = await Promise.all([
const [registrations, payments, tickets, waitlist, certificates, feedback, consents, security, requests, notices, family, volunteering] = await Promise.all([
db.registration.findMany({
where: { userId },
orderBy: { createdAt: 'asc' },
@@ -507,6 +510,7 @@ async function exportUserData(userId, db = prisma) {
db.dataRequest.findMany({ where: { userId }, orderBy: { createdAt: 'desc' }, select: { type: true, status: true, details: true, response: true, createdAt: true, closedAt: true } }),
db.noticeAcceptance.findMany({ where: { userId }, orderBy: { createdAt: 'desc' }, select: { version: true, source: true, createdAt: true } }),
require('./kids').exportFamily(userId, db),
require('./volunteers').exportVolunteering(userId, db),
]);
return {
@@ -549,6 +553,7 @@ async function exportUserData(userId, db = prisma) {
accountActivity: security.map(s => ({ type: s.type, ip: s.ip, device: s.device, at: s.createdAt })),
dataRequests: requests,
kidsFamily: family,
volunteering,
};
}
@@ -605,6 +610,10 @@ async function dataExportPdf(data) {
heading('Certificates');
for (const c of data.certificates) para(`${c.event} — ${c.code}${c.revoked ? ' (withdrawn)' : ''}`);
}
if (data.volunteering?.length) {
heading('Serving (volunteer rosters)');
for (const s of data.volunteering) para(`${fmt(s.from)} — ${s.role}, ${s.event}${s.checkedIn ? ' (checked in)' : ''}`);
}
if (data.feedback.length) {
heading('Feedback you gave');
for (const f of data.feedback) {