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")
|
|
|
|
embedTitle String?
|
|
|
|
embedColor String @default("#2f3136")
|
|
|
|
embedSiteName String? @default("{image.file} • {user.name}")
|
|
|
|
ratelimit DateTime?
|
2022-11-18 01:13:17 -05:00
|
|
|
totpSecret String?
|
2022-10-30 23:42:39 -05:00
|
|
|
domains String[]
|
|
|
|
oauth OAuth[]
|
|
|
|
images Image[]
|
|
|
|
urls Url[]
|
|
|
|
Invite Invite[]
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 01:01:31 -05:00
|
|
|
enum ImageFormat {
|
|
|
|
UUID
|
|
|
|
DATE
|
|
|
|
RANDOM
|
|
|
|
NAME
|
|
|
|
}
|
|
|
|
|
2021-08-25 12:01:57 -05:00
|
|
|
model Image {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
file String
|
|
|
|
mimetype String @default("image/png")
|
|
|
|
created_at DateTime @default(now())
|
2022-07-28 15:53:46 -05:00
|
|
|
expires_at DateTime?
|
2022-10-27 21:34:20 -05:00
|
|
|
maxViews Int?
|
2021-08-25 12:01:57 -05:00
|
|
|
views Int @default(0)
|
2021-08-27 15:48:22 -05:00
|
|
|
favorite Boolean @default(false)
|
2021-09-02 22:59:30 -05:00
|
|
|
embed Boolean @default(false)
|
2022-06-05 00:05:08 -05:00
|
|
|
password String?
|
2021-08-25 12:01:57 -05:00
|
|
|
invisible InvisibleImage?
|
2022-02-21 01:01:31 -05:00
|
|
|
format ImageFormat @default(RANDOM)
|
2022-10-30 23:42:39 -05:00
|
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
userId Int?
|
2021-08-25 12:01:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
model InvisibleImage {
|
2021-09-17 22:39:20 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
invis String @unique
|
2022-06-05 00:05:08 -05:00
|
|
|
imageId Int @unique
|
2022-11-28 23:39:20 -05:00
|
|
|
image Image @relation(fields: [imageId], 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?
|
|
|
|
created_at 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?
|
2022-11-28 23:39:20 -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
|
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 {
|
2022-06-05 00:05:08 -05:00
|
|
|
id Int @id @default(autoincrement())
|
2022-01-03 18:56:33 -05:00
|
|
|
created_at DateTime @default(now())
|
|
|
|
data Json
|
2022-06-05 00:05:08 -05:00
|
|
|
}
|
2022-07-13 21:31:23 -05:00
|
|
|
|
|
|
|
model Invite {
|
2022-10-30 23:42:39 -05:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
code String @unique
|
|
|
|
created_at DateTime @default(now())
|
|
|
|
expires_at DateTime?
|
|
|
|
used Boolean @default(false)
|
2022-11-28 23:39:20 -05:00
|
|
|
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
|
|
|
|
}
|