1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-11 10:20:15 +01:00
pingvin-share/backend/prisma/schema.prisma

144 lines
3.3 KiB
Plaintext
Raw Normal View History

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
2022-12-01 23:07:49 +01:00
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)
2023-02-09 18:17:53 +01:00
totpSecret String?
resetPasswordToken ResetPasswordToken?
}
model RefreshToken {
2023-01-04 11:54:28 +01:00
id String @id @default(uuid())
token String @unique @default(uuid())
createdAt DateTime @default(now())
expiresAt DateTime
userId String
2022-10-13 23:26:56 +02:00
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)
}
2023-02-09 18:17:53 +01:00
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)
2023-02-09 18:17:53 +01:00
}
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
2023-01-26 14:06:25 +01:00
key String @id
2022-12-01 23:07:49 +01:00
type String
value String
description String
category String
2022-12-08 19:14:06 +01:00
obscured Boolean @default(false)
2022-12-01 23:07:49 +01:00
secret Boolean @default(true)
locked Boolean @default(false)
2023-01-26 14:06:25 +01:00
order Int
}