feat: storage/file quota + urls quota

This commit is contained in:
diced
2024-04-16 20:34:04 -07:00
parent f1e2d50fd5
commit 7e137c0991
12 changed files with 272 additions and 34 deletions

View File

@@ -30,16 +30,37 @@ model User {
totpSecret String?
passkeys UserPasskey[]
quota UserQuota?
files File[]
urls Url[]
folders Folder[]
limits UserLimit[]
invites Invite[]
tags Tag[]
oauthProviders OAuthProvider[]
IncompleteFile IncompleteFile[]
}
model UserQuota {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
filesQuota UserFilesQuota
maxBytes String?
maxFiles Int?
maxUrls Int?
User User? @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String? @unique
}
enum UserFilesQuota {
BY_BYTES
BY_FILES
}
model UserPasskey {
id String @id @default(cuid())
createdAt DateTime @default(now())
@@ -85,35 +106,6 @@ enum OAuthProviderType {
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())