44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
name String?
|
|
password String
|
|
role String @default("DOMAIN_ADMIN") // SUPER_ADMIN or DOMAIN_ADMIN
|
|
domains String[] @default([]) // ["*"] or list of domains
|
|
telegramId String?
|
|
mailboxMappings MailboxMapping[]
|
|
notificationConfigs NotificationConfig[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model MailboxMapping {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model NotificationConfig {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
type String // e.g., "TELEGRAM", "WEBHOOK"
|
|
value String // e.g., chat_id or webhook url
|
|
active Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
}
|