mirror of
https://github.com/diced/zipline.git
synced 2025-12-12 15:50:11 -08:00
243 lines
4.9 KiB
Plaintext
243 lines
4.9 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Zipline {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
firstSetup Boolean @default(true)
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
username String @unique
|
|
password String?
|
|
avatar String?
|
|
token String @unique
|
|
role Role @default(USER)
|
|
view Json @default("{}")
|
|
|
|
totpSecret String?
|
|
passkeys UserPasskey[]
|
|
|
|
files File[]
|
|
urls Url[]
|
|
folders Folder[]
|
|
limits UserLimit[]
|
|
invites Invite[]
|
|
tags Tag[]
|
|
oauthProviders OAuthProvider[]
|
|
IncompleteFile IncompleteFile[]
|
|
}
|
|
|
|
model UserPasskey {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
lastUsed DateTime?
|
|
|
|
name String
|
|
reg Json
|
|
|
|
User User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
userId String
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
SUPERADMIN
|
|
}
|
|
|
|
model OAuthProvider {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
userId String
|
|
provider OAuthProviderType
|
|
|
|
username String
|
|
accessToken String
|
|
refreshToken String?
|
|
oauthId String?
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@unique([provider, oauthId])
|
|
}
|
|
|
|
enum OAuthProviderType {
|
|
DISCORD
|
|
GOOGLE
|
|
GITHUB
|
|
AUTHENTIK
|
|
}
|
|
|
|
model UserLimit {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
type LimitType @unique
|
|
value Int
|
|
timeframe LimitTimeframe
|
|
|
|
User User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
userId String
|
|
}
|
|
|
|
enum LimitType {
|
|
UPLOAD_COUNT
|
|
UPLOAD_SIZE
|
|
SHORTEN_COUNT
|
|
}
|
|
|
|
enum LimitTimeframe {
|
|
SECONDLY
|
|
MINUTELY
|
|
HOURLY
|
|
DAILY
|
|
WEEKLY
|
|
MONTHLY
|
|
YEARLY
|
|
}
|
|
|
|
model File {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
deletesAt DateTime?
|
|
|
|
name String // name & file saved on datasource
|
|
originalName String? // original name of file when uploaded
|
|
size BigInt
|
|
type String
|
|
views Int @default(0)
|
|
maxViews Int?
|
|
favorite Boolean @default(false)
|
|
password String?
|
|
|
|
tags Tag[]
|
|
|
|
User User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
userId String?
|
|
|
|
Folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
folderId String?
|
|
|
|
thumbnail Thumbnail?
|
|
}
|
|
|
|
model Thumbnail {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
path String
|
|
|
|
file File @relation(fields: [fileId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
fileId String
|
|
|
|
@@unique([fileId])
|
|
}
|
|
|
|
model Folder {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
name String
|
|
public Boolean @default(false)
|
|
|
|
files File[]
|
|
|
|
User User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
userId String
|
|
}
|
|
|
|
model IncompleteFile {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
status IncompleteFileStatus
|
|
chunksTotal Int
|
|
chunksComplete Int
|
|
|
|
metadata Json
|
|
|
|
User User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
userId String
|
|
}
|
|
|
|
enum IncompleteFileStatus {
|
|
PENDING
|
|
PROCESSING
|
|
COMPLETE
|
|
FAILED
|
|
}
|
|
|
|
model Tag {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
name String @unique
|
|
color String
|
|
|
|
files File[]
|
|
User User? @relation(fields: [userId], references: [id])
|
|
userId String?
|
|
}
|
|
|
|
model Url {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
code String
|
|
vanity String?
|
|
destination String
|
|
views Int @default(0)
|
|
maxViews Int?
|
|
|
|
User User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
userId String?
|
|
|
|
@@unique([code, vanity])
|
|
}
|
|
|
|
model Metric {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
data Json
|
|
}
|
|
|
|
model Invite {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
expiresAt DateTime?
|
|
|
|
code String @unique
|
|
uses Int @default(0)
|
|
maxUses Int?
|
|
|
|
inviter User @relation(fields: [inviterId], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
inviterId String
|
|
}
|