diff --git a/src/services/auth/auth-models.ts b/src/services/auth/auth-models.ts index 9ee25f6..771d1d3 100644 --- a/src/services/auth/auth-models.ts +++ b/src/services/auth/auth-models.ts @@ -4,6 +4,6 @@ export const Role = z.enum(["USER", "STAFF", "ADMIN", "CORPORATE"]); export const JwtPayloadValidator = z.object({ userId: z.string(), - name: z.string(), + displayName: z.string(), roles: Role.array(), }); diff --git a/src/services/auth/auth-utils.ts b/src/services/auth/auth-utils.ts index f0799b1..8d6a812 100644 --- a/src/services/auth/auth-utils.ts +++ b/src/services/auth/auth-utils.ts @@ -15,7 +15,7 @@ export function createGoogleStrategy(device: string) { // Strategy -> insert user into database if they don't exist async function (_1, _2, profile, cb) { const userId = `user${profile.id}`; - const name = profile.displayName; + const displayName = profile.displayName; const email = profile._json.email; const roles = []; @@ -26,7 +26,7 @@ export function createGoogleStrategy(device: string) { Database.ROLES.findOneAndUpdate( { userId: userId }, - { userId, name, email, roles }, + { userId, displayName, email, roles }, { upsert: true } ) .then(() => cb(null, profile)) @@ -38,7 +38,7 @@ export function createGoogleStrategy(device: string) { export async function getJwtPayloadFromDatabase(userId: string) { const payload = await Database.ROLES.findOne({ userId: userId }).select([ "userId", - "name", + "displayName", "roles", ]); if (!payload) {