101 lines
2.5 KiB
Plaintext
101 lines
2.5 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"
|
|
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
password String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
calendars Calendar[]
|
|
events Event[]
|
|
mailCredentials MailCredentials[]
|
|
webdavCredentials WebDAVCredentials?
|
|
}
|
|
|
|
model Calendar {
|
|
id String @id @default(uuid())
|
|
name String
|
|
color String @default("#0082c9")
|
|
description String?
|
|
userId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
events Event[]
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model Event {
|
|
id String @id @default(uuid())
|
|
title String
|
|
description String?
|
|
start DateTime
|
|
end DateTime
|
|
location String?
|
|
isAllDay Boolean @default(false)
|
|
calendar Calendar @relation(fields: [calendarId], references: [id], onDelete: Cascade)
|
|
calendarId String
|
|
userId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([calendarId])
|
|
@@index([userId])
|
|
}
|
|
|
|
model MailCredentials {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
email String
|
|
password String? // Make password optional
|
|
host String
|
|
port Int
|
|
secure Boolean @default(true)
|
|
|
|
// OAuth Settings
|
|
use_oauth Boolean @default(false)
|
|
refresh_token String?
|
|
access_token String?
|
|
token_expiry DateTime?
|
|
|
|
// SMTP Settings
|
|
smtp_host String?
|
|
smtp_port Int?
|
|
smtp_secure Boolean? @default(false)
|
|
|
|
// Display Settings
|
|
display_name String?
|
|
color String? @default("#0082c9")
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([userId, email])
|
|
@@index([userId])
|
|
}
|
|
|
|
model WebDAVCredentials {
|
|
id String @id @default(uuid())
|
|
userId String @unique
|
|
username String
|
|
password String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
} |