Add unified expertise tag system and round entry notifications

- ExpertiseSelect now fetches tags from database with category grouping
- Tags set by admin during invitation are locked and cannot be removed
- Onboarding merges user-selected tags with admin-preset tags
- MENTOR role now goes through onboarding flow
- Added migration for Round.entryNotificationType column
- Added seed script with ~90 comprehensive expertise tags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 01:15:21 +01:00
parent 41a36f72b3
commit 8cdf6c9e5e
5 changed files with 475 additions and 80 deletions

View File

@@ -734,12 +734,23 @@ export const userRouter = router({
})
)
.mutation(async ({ ctx, input }) => {
// Get existing user to preserve admin-set tags
const existingUser = await ctx.prisma.user.findUniqueOrThrow({
where: { id: ctx.user.id },
select: { expertiseTags: true },
})
// Merge admin-set tags with user-selected tags (preserving order: admin first, then user)
const adminTags = existingUser.expertiseTags || []
const userTags = input.expertiseTags || []
const mergedTags = [...new Set([...adminTags, ...userTags])]
const user = await ctx.prisma.user.update({
where: { id: ctx.user.id },
data: {
name: input.name,
phoneNumber: input.phoneNumber,
expertiseTags: input.expertiseTags || [],
expertiseTags: mergedTags,
notificationPreference: input.notificationPreference || 'EMAIL',
onboardingCompletedAt: new Date(),
status: 'ACTIVE', // Activate user after onboarding
@@ -771,8 +782,9 @@ export const userRouter = router({
select: { onboardingCompletedAt: true, role: true },
})
// Only jury members need onboarding
if (user.role !== 'JURY_MEMBER') {
// Jury members and mentors need onboarding
const rolesRequiringOnboarding = ['JURY_MEMBER', 'MENTOR']
if (!rolesRequiringOnboarding.includes(user.role)) {
return false
}