diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index 00ad0dd1873..7100efac0e5 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -101,7 +101,7 @@ model user { donationEmails String[] // Undefined | String[] (only possible for built in Types like String) email String emailAuthLinkTTL DateTime? // Null | Undefined - emailVerified Boolean + emailVerified Boolean? emailVerifyTTL DateTime? // Null | Undefined externalId String githubProfile String? // Undefined diff --git a/api/src/routes/protected/user.ts b/api/src/routes/protected/user.ts index 385e7807a6f..1095f723fb2 100644 --- a/api/src/routes/protected/user.ts +++ b/api/src/routes/protected/user.ts @@ -612,6 +612,7 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = ( const [flags, rest] = splitUser(user); const { + emailVerified, username, usernameDisplay, completedChallenges, @@ -639,13 +640,14 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = ( calendar: getCalendar( progressTimestamps as ProgressTimestamp[] | null ), + emailVerified: !!emailVerified, // This assertion is necessary until the database is normalized. points: getPoints( progressTimestamps as ProgressTimestamp[] | null ), profileUI: normalizeProfileUI(profileUI), // TODO(Post-MVP) remove this and just use emailVerified - isEmailVerified: user.emailVerified, + isEmailVerified: !!emailVerified, joinDate: new ObjectId(user.id).getTimestamp().toISOString(), location: location ?? '', name: name ?? '',