mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-11-16 12:20:13 +01:00
beece56327
* More email share vars + unfinished placeolders config {desc} {expires} vars (unfinished) config placeholder vals * done * migrate * edit seed * removed comments * refactor: replace dependecy `luxon` with `moment` * update shareRecipientsMessage message * chore: remove `luxon` * fix: grammatically incorrect `shareRecipientsMessage` message * changed to defaultValue and value instead * fix: don't expose defaultValue to non admin user * fix: update default value if default value changes * refactor: set config value to null instead of a empty string * refactor: merge two migrations into one * fix value check empty --------- Co-authored-by: Elias Schneider <login@eliasschneider.com>
147 lines
3.4 KiB
Plaintext
147 lines
3.4 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = "file:../data/pingvin-share.db"
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
username String @unique
|
|
email String @unique
|
|
password String
|
|
isAdmin Boolean @default(false)
|
|
|
|
shares Share[]
|
|
refreshTokens RefreshToken[]
|
|
loginTokens LoginToken[]
|
|
reverseShares ReverseShare[]
|
|
|
|
totpEnabled Boolean @default(false)
|
|
totpVerified Boolean @default(false)
|
|
totpSecret String?
|
|
resetPasswordToken ResetPasswordToken?
|
|
}
|
|
|
|
model RefreshToken {
|
|
id String @id @default(uuid())
|
|
token String @unique @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
expiresAt DateTime
|
|
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model LoginToken {
|
|
token String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
expiresAt DateTime
|
|
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
used Boolean @default(false)
|
|
}
|
|
|
|
model ResetPasswordToken {
|
|
token String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
expiresAt DateTime
|
|
|
|
userId String @unique
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model Share {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
uploadLocked Boolean @default(false)
|
|
isZipReady Boolean @default(false)
|
|
views Int @default(0)
|
|
expiration DateTime
|
|
description String?
|
|
removedReason String?
|
|
|
|
creatorId String?
|
|
creator User? @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
|
|
reverseShareId String?
|
|
reverseShare ReverseShare? @relation(fields: [reverseShareId], references: [id], onDelete: Cascade)
|
|
|
|
security ShareSecurity?
|
|
recipients ShareRecipient[]
|
|
files File[]
|
|
}
|
|
|
|
model ReverseShare {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
token String @unique @default(uuid())
|
|
shareExpiration DateTime
|
|
maxShareSize String
|
|
sendEmailNotification Boolean
|
|
remainingUses Int
|
|
|
|
creatorId String
|
|
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
|
|
shares Share[]
|
|
}
|
|
|
|
model ShareRecipient {
|
|
id String @id @default(uuid())
|
|
email String
|
|
|
|
shareId String
|
|
share Share @relation(fields: [shareId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model File {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
name String
|
|
size String
|
|
|
|
shareId String
|
|
share Share @relation(fields: [shareId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model ShareSecurity {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
password String?
|
|
maxViews Int?
|
|
|
|
shareId String? @unique
|
|
share Share? @relation(fields: [shareId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model Config {
|
|
updatedAt DateTime @updatedAt
|
|
|
|
name String
|
|
category String
|
|
type String
|
|
defaultValue String @default("")
|
|
value String?
|
|
description String
|
|
obscured Boolean @default(false)
|
|
secret Boolean @default(true)
|
|
locked Boolean @default(false)
|
|
order Int
|
|
|
|
@@id([name, category])
|
|
}
|