Skip to content

Commit

Permalink
Rename "name" to "displayName"
Browse files Browse the repository at this point in the history
  • Loading branch information
anandani4136 committed Jun 14, 2024
1 parent 0790066 commit 72ac69a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/services/auth/auth-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
6 changes: 3 additions & 3 deletions src/services/auth/auth-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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))
Expand All @@ -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) {
Expand Down

0 comments on commit 72ac69a

Please sign in to comment.