feat: Change auth flow
This commit is contained in:
@@ -1,30 +1,45 @@
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
firstName String
|
||||
middleName String?
|
||||
lastName String
|
||||
email String @unique
|
||||
password String
|
||||
role USER_ROLE @default(user)
|
||||
isVerified Boolean? @default(false) // TODO: Email using queue
|
||||
refreshToken String?
|
||||
profilePicture String?
|
||||
isDeleted Boolean? @default(false)
|
||||
deletedAt DateTime?
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
password String?
|
||||
role USER_ROLE @default(user)
|
||||
refreshToken String?
|
||||
status USER_ACCOUNT_STATUS @default(pending)
|
||||
isDeleted Boolean? @default(false)
|
||||
deletedAt DateTime?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
organizations OrganizationUserJoinTable[]
|
||||
organizationsRequested OrganizationJoinRequest[]
|
||||
organizations OrganizationUserJoinTable[]
|
||||
organizationsRequested OrganizationJoinRequest[]
|
||||
userAdditionalInformation UserAdditionalInformation?
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
|
||||
model UserAdditionalInformation {
|
||||
id String @id @default(uuid())
|
||||
userId String @unique
|
||||
firstName String
|
||||
middleName String?
|
||||
lastName String
|
||||
profilePicture String?
|
||||
address String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model UserOTP {
|
||||
email String @unique
|
||||
otp Int
|
||||
generatedOn DateTime
|
||||
email String @unique
|
||||
otp Int
|
||||
// ExipresAt is also saved so its easier to check and also
|
||||
// run cron job to remove expired OTPs
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
|
||||
@@map("user_otp")
|
||||
}
|
||||
@@ -33,3 +48,10 @@ enum USER_ROLE {
|
||||
superadmin
|
||||
user
|
||||
}
|
||||
|
||||
enum USER_ACCOUNT_STATUS {
|
||||
pending
|
||||
active
|
||||
suspended
|
||||
deleted
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user