Skip to content

Commit

Permalink
fix(auth): userInformation creation error
Browse files Browse the repository at this point in the history
  • Loading branch information
JowiAoun committed Aug 10, 2024
1 parent 6449827 commit ffe586d
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ declare module 'next-auth' {
PrismaUser
}

interface User {
// ...other properties
}
// interface User {
// // ...other properties
// }
}

function getFirstNameAndLastName(name: string): { firstName: string, lastName: string } {
Expand Down Expand Up @@ -67,26 +67,22 @@ async function createUserEventHandler(message: { user: User }) {

// create a default UserInformation object with all values set to null
const userInformation: UserInformation = {
email: user.email,
id: user.id,
email: user.email,
first_name: firstName,
last_name: lastName,
school: null,
levels_of_study: null,
major: null,
date_of_birth: null,
gender: null,
phone_number: null,
levels_of_study: null,
school: null,
userId: user.id,
}

await db.userInformation.create({
data: {
...userInformation,
user: {
connect: {
id: user.id,
},
},
},
})
}
Expand Down

0 comments on commit ffe586d

Please sign in to comment.