128 lines
3.1 KiB
Text
128 lines
3.1 KiB
Text
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
username String
|
|
password String?
|
|
avatar String?
|
|
token String
|
|
administrator Boolean @default(false)
|
|
superAdmin Boolean @default(false)
|
|
systemTheme String @default("system")
|
|
embed Json @default("{}")
|
|
ratelimit DateTime?
|
|
totpSecret String?
|
|
domains String[]
|
|
oauth OAuth[]
|
|
files File[]
|
|
urls Url[]
|
|
Invite Invite[]
|
|
Folder Folder[]
|
|
}
|
|
|
|
model Folder {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
public Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId Int
|
|
|
|
files File[]
|
|
}
|
|
|
|
model File {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
originalName String?
|
|
mimetype String @default("image/png")
|
|
createdAt DateTime @default(now())
|
|
size Int @default(0)
|
|
expiresAt DateTime?
|
|
maxViews Int?
|
|
views Int @default(0)
|
|
favorite Boolean @default(false)
|
|
embed Boolean @default(false)
|
|
password String?
|
|
invisible InvisibleFile?
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
userId Int?
|
|
|
|
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
|
folderId Int?
|
|
}
|
|
|
|
model InvisibleFile {
|
|
id Int @id @default(autoincrement())
|
|
invis String @unique
|
|
|
|
fileId Int @unique
|
|
file File @relation(fields: [fileId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model Url {
|
|
id String @id @unique
|
|
destination String
|
|
vanity String?
|
|
createdAt DateTime @default(now())
|
|
maxViews Int?
|
|
views Int @default(0)
|
|
invisible InvisibleUrl?
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
userId Int?
|
|
}
|
|
|
|
model InvisibleUrl {
|
|
id Int @id @default(autoincrement())
|
|
invis String @unique
|
|
|
|
urlId String @unique
|
|
url Url @relation(fields: [urlId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model Stats {
|
|
id Int @id @default(autoincrement())
|
|
createdAt DateTime @default(now())
|
|
data Json
|
|
}
|
|
|
|
model Invite {
|
|
id Int @id @default(autoincrement())
|
|
code String @unique
|
|
createdAt DateTime @default(now())
|
|
expiresAt DateTime?
|
|
used Boolean @default(false)
|
|
|
|
createdBy User @relation(fields: [createdById], references: [id], onDelete: Cascade)
|
|
createdById Int
|
|
}
|
|
|
|
model OAuth {
|
|
id Int @id @default(autoincrement())
|
|
provider OauthProviders
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId Int
|
|
username String
|
|
oauthId String?
|
|
token String
|
|
refresh String?
|
|
|
|
@@unique([provider, oauthId])
|
|
}
|
|
|
|
enum OauthProviders {
|
|
DISCORD
|
|
GITHUB
|
|
GOOGLE
|
|
}
|