Files
webmailserver/prisma/schema.prisma

68 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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?
telegramEnabled Boolean @default(true)
whatsappNumber String?
whatsappEnabled Boolean @default(false)
mailboxMappings MailboxMapping[]
notificationConfigs NotificationConfig[]
notificationLogs NotificationLog[]
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())
}
model NotificationLog {
id String @id @default(cuid())
mailbox String // Bildirim gelen mail adresi
sender String? // Gönderen kişi
subject String? // Konu
status String // "SENT", "FAILED"
error String? // Hata varsa detayı
userId String? // Hangi kullanıcıya bildirim gittiği
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
createdAt DateTime @default(now())
}
model SystemLog {
id String @id @default(cuid())
level String // "INFO", "WARN", "ERROR"
message String
details String?
createdAt DateTime @default(now())
}