feat: round user tracker + fix INVITED status not updating on login
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled

- Replace Semi-Finalist Tracker with Round User Tracker on dashboard
- New getRoundUserStats query: round-aware account activation stats
- Round selector dropdown to view any round's passed projects
- sendAccountReminders now accepts optional roundId for scoped reminders
- Fix: signIn callback now sets status=ACTIVE for INVITED users on login
- DB fix: 5 users who logged in via magic link but stayed INVITED → ACTIVE

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 14:00:19 +01:00
parent ee8e90132e
commit 8cdcc85555
4 changed files with 335 additions and 21 deletions

View File

@@ -390,11 +390,21 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
user.mustSetPassword = dbUser.mustSetPassword || !dbUser.passwordHash
}
// Update last login time on actual sign-in
// Update last login time on actual sign-in, and activate INVITED users on login
if (user.email) {
const loginUser = await prisma.user.findUnique({
where: { email: user.email },
select: { status: true },
})
await prisma.user.update({
where: { email: user.email },
data: { lastLoginAt: new Date() },
data: {
lastLoginAt: new Date(),
// If user is still INVITED but successfully logged in, activate them
...(loginUser && loginUser.status === 'INVITED'
? { status: 'ACTIVE' }
: {}),
},
}).catch(() => {
// Ignore errors from updating last login
})