2021-08-25 12:01:57 -05:00
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2022-10-30 23:42:39 -05:00
|
|
|
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")
|
2023-01-12 00:33:01 -05:00
|
|
|
embed Json @default("{}")
|
2022-10-30 23:42:39 -05:00
|
|
|
ratelimit DateTime?
|
2022-11-18 01:13:17 -05:00
|
|
|
totpSecret String?
|
2022-10-30 23:42:39 -05:00
|
|
|
domains String[]
|
|
|
|
oauth OAuth[]
|
2023-02-11 01:32:57 -05:00
|
|
|
files File[]
|
2022-10-30 23:42:39 -05:00
|
|
|
urls Url[]
|
|
|
|
Invite Invite[]
|
2023-02-11 01:32:57 -05:00
|
|
|
Folder Folder[]
|
|
|
|
}
|
|
|
|
|
|
|
|
model Folder {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
2023-02-23 17:37:22 -05:00
|
|
|
public Boolean @default(false)
|
2023-02-11 01:32:57 -05:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
|
|
|
|
files File[]
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
2023-01-15 16:39:07 -05:00
|
|
|
model File {
|
2023-02-11 01:32:57 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
2023-01-15 16:57:28 -05:00
|
|
|
originalName String?
|
2023-02-11 01:32:57 -05:00
|
|
|
mimetype String @default("image/png")
|
|
|
|
createdAt DateTime @default(now())
|
2023-03-03 23:40:28 -05:00
|
|
|
size Int @default(0)
|
2023-02-11 01:32:57 -05:00
|
|
|
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?
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
2023-01-15 16:39:07 -05:00
|
|
|
model InvisibleFile {
|
2023-02-11 01:32:57 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
invis String @unique
|
|
|
|
|
|
|
|
fileId Int @unique
|
|
|
|
file File @relation(fields: [fileId], references: [id], onDelete: Cascade)
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
model Url {
|
2021-09-24 22:31:45 -05:00
|
|
|
id String @id @unique
|
|
|
|
destination String
|
|
|
|
vanity String?
|
2023-01-15 16:39:07 -05:00
|
|
|
createdAt DateTime @default(now())
|
2022-10-27 21:34:20 -05:00
|
|
|
maxViews Int?
|
2021-09-24 22:31:45 -05:00
|
|
|
views Int @default(0)
|
|
|
|
invisible InvisibleUrl?
|
2023-02-11 01:32:57 -05:00
|
|
|
|
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
userId Int?
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
model InvisibleUrl {
|
2021-09-24 22:31:45 -05:00
|
|
|
id Int @id @default(autoincrement())
|
2021-08-26 14:32:51 -05:00
|
|
|
invis String @unique
|
2023-02-11 01:32:57 -05:00
|
|
|
|
2022-06-05 00:05:08 -05:00
|
|
|
urlId String @unique
|
2022-11-28 23:39:20 -05:00
|
|
|
url Url @relation(fields: [urlId], references: [id], onDelete: Cascade)
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
2022-01-03 18:56:33 -05:00
|
|
|
|
|
|
|
model Stats {
|
2023-02-11 01:32:57 -05:00
|
|
|
id Int @id @default(autoincrement())
|
2023-01-15 16:39:07 -05:00
|
|
|
createdAt DateTime @default(now())
|
2023-02-11 01:32:57 -05:00
|
|
|
data Json
|
2022-06-05 00:05:08 -05:00
|
|
|
}
|
2022-07-13 21:31:23 -05:00
|
|
|
|
|
|
|
model Invite {
|
2023-02-11 01:32:57 -05:00
|
|
|
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)
|
2022-07-13 21:31:23 -05:00
|
|
|
createdById Int
|
|
|
|
}
|
2022-10-30 23:42:39 -05:00
|
|
|
|
|
|
|
model OAuth {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
provider OauthProviders
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
username String
|
2022-12-17 17:12:44 -05:00
|
|
|
oauthId String?
|
2022-10-30 23:42:39 -05:00
|
|
|
token String
|
|
|
|
refresh String?
|
2022-12-07 00:40:13 -05:00
|
|
|
|
|
|
|
@@unique([provider, oauthId])
|
2022-10-30 23:42:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
enum OauthProviders {
|
|
|
|
DISCORD
|
|
|
|
GITHUB
|
|
|
|
GOOGLE
|
|
|
|
}
|