fix(users): populate roles[] with primary role on user creation

All user-creation paths (admin create, bulk invite import, public application
contact + team members, project team members, jury-group + special-award
invites) now set roles=[role] so the invariant role in roles[] holds for new
users, matching seed.ts and the role-change mutations. Prevents the empty
roles[] inconsistency that hid primary-role mentors from the mentor picker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-06-01 20:06:52 +02:00
parent 501b4ffdb5
commit 60f1a53d70
6 changed files with 51 additions and 0 deletions

View File

@@ -697,6 +697,7 @@ export const specialAwardRouter = router({
email: invitee.email,
name: invitee.name || null,
role: 'JURY_MEMBER',
roles: ['JURY_MEMBER'],
status: 'INVITED',
inviteToken,
inviteTokenExpiresAt: new Date(Date.now() + expiryMs),