update prisma schema
This commit is contained in:
parent
b3e3312445
commit
e781de64a1
@ -17,15 +17,18 @@ model Account {
|
||||
providerAccountId String
|
||||
refresh_token String? @db.Text
|
||||
access_token String? @db.Text
|
||||
expires_at Int?
|
||||
expires_at Int? // Üblicherweise für access_token Ablauf (in Sekunden seit Unix-Epoche)
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? @db.Text
|
||||
session_state String?
|
||||
|
||||
refresh_expires_in Int? // NEU: Lebensdauer des Refresh Tokens in Sekunden
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
@@index([userId]) // Index für userId hinzugefügt für bessere Abfrageleistung
|
||||
}
|
||||
|
||||
model Session {
|
||||
@ -34,32 +37,35 @@ model Session {
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([userId]) // Index für userId hinzugefügt
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime? // Von NextAuth benötigt
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
password String? // Für CredentialsProvider
|
||||
password String?
|
||||
role String? @default("user")
|
||||
balance Decimal? @default(0.00) @db.Decimal(10, 2)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
// Felder für den Freigabeprozess
|
||||
isApproved Boolean @default(false) // Ist der Benutzer vom Admin freigegeben?
|
||||
approvedAt DateTime? // Wann wurde der Benutzer freigegeben?
|
||||
approvedByAdminId String? // ID des Admins, der den Benutzer freigegeben hat
|
||||
isApproved Boolean @default(false)
|
||||
approvedAt DateTime?
|
||||
approvedByAdminId String?
|
||||
approvedByAdmin User? @relation("AdminApprovals", fields: [approvedByAdminId], references: [id], onDelete: SetNull)
|
||||
|
||||
isLocked Boolean @default(false)
|
||||
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
transactions Transaction[]
|
||||
triggeredTransactions Transaction[] @relation("AdminTransactions")
|
||||
approvedUsers User[] @relation("AdminApprovals") // Benutzer, die dieser Admin freigegeben hat
|
||||
approvedUsers User[] @relation("AdminApprovals")
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
@ -84,5 +90,5 @@ model Transaction {
|
||||
triggeredByAdmin User? @relation("AdminTransactions", fields: [triggeredByAdminId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([triggeredByAdminId])
|
||||
@@index([userId]) // Index für userId in Transaction hinzugefügt
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user