Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
refactor: Minor changes to Prisma Model
Browse files Browse the repository at this point in the history
  • Loading branch information
ralvarezdev committed Oct 14, 2024
1 parent f89a78f commit 43fdaf6
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ datasource db {
}

model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
emails UserEmail[]
roles UserRole[] @relation(name: "user")
username String @unique
firstName String
lastName String
password String
address String?
phone String?
birthDate DateTime?
deleted Boolean @default(false)
jwtRefreshTokens JwtRefreshToken[]
usernameHistory UsernameHistory[]
passwordHistory PasswordHistory[]
assignedRoles UserRole[] @relation(name: "assignedBy")
revokedRoles UserRole[] @relation(name: "revokedBy")
loginAttempts UserLoginAttempt[]
id String @id @default(auto()) @map("_id") @db.ObjectId
emails UserEmail[]
roles UserRole[] @relation(name: "user")
username String @unique
firstName String
lastName String
password String
address String?
phone String?
birthDate DateTime?
deleted Boolean @default(false)
logUsername LogUsername[]
logPassword LogPassword[]
assignedRoles UserRole[] @relation(name: "assignedBy")
revokedRoles UserRole[] @relation(name: "revokedBy")
loginAttempts UserLoginAttempt[]
}

model UserLoginAttempt {
Expand Down Expand Up @@ -79,15 +78,15 @@ model PasswordResetToken {
userEmailId String @db.ObjectId
}

model UsernameHistory {
model LogUsername {
id String @id @default(auto()) @map("_id") @db.ObjectId
username String
assignedAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
userId String @db.ObjectId
}

model PasswordHistory {
model LogPassword {
id String @id @default(auto()) @map("_id") @db.ObjectId
password String
assignedAt DateTime @default(now())
Expand All @@ -114,8 +113,6 @@ model JwtRefreshToken {
revokedAt DateTime?
jwtAccessToken JwtAccessToken @relation(fields: [jwtAccessTokenId], references: [id])
jwtAccessTokenId String @unique @db.ObjectId
user User @relation(fields: [userId], references: [id])
userId String @db.ObjectId
userLoginAttempt UserLoginAttempt? @relation(fields: [userLoginAttemptId], references: [id])
userLoginAttemptId String? @unique @db.ObjectId
parentJwtRefreshToken JwtRefreshToken? @relation(name: "parentJwtRefreshToken", fields: [parentJwtRefreshTokenId], references: [id], onDelete: NoAction, onUpdate: NoAction)
Expand Down

0 comments on commit 43fdaf6

Please sign in to comment.