83 lines
1.5 KiB
Plaintext
83 lines
1.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "./__generated__"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("POSTGRES_URI")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
|
|
email String @unique
|
|
password String
|
|
|
|
displayName String
|
|
picture String?
|
|
|
|
role UserRole @default(REGULAR)
|
|
|
|
isVerified Boolean @default(false) @map("is_verified")
|
|
isTwoFactorEnabled Boolean @default(false) @map("is_two_factor_enabled")
|
|
|
|
method AuthMethod
|
|
|
|
accounts Account[]
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(uuid())
|
|
|
|
type String
|
|
provider String
|
|
|
|
refreshToken String? @map("refresh_token")
|
|
accessToken String? @map("access_token")
|
|
expiresAt Int @map("expires_at")
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
userId String? @map("user_id")
|
|
|
|
@@map("accounts")
|
|
}
|
|
|
|
model Token {
|
|
id String @id @default(uuid())
|
|
|
|
email String
|
|
token String @unique
|
|
type TokenType
|
|
expiresIn DateTime @map("expires_in")
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@map("tokens")
|
|
}
|
|
|
|
enum UserRole {
|
|
REGULAR
|
|
ADMIN
|
|
}
|
|
|
|
enum AuthMethod {
|
|
CREDENTIALS
|
|
GOOGLE
|
|
YANDEX
|
|
}
|
|
|
|
enum TokenType {
|
|
VERIFICATION
|
|
TWO_FACTOR
|
|
PASSWORD_RESET
|
|
}
|