Files
drop/server/prisma/schema.prisma
T
DecDuck 661a30107c object storage + full permission system + testing
Object storage now works fully, with the permission system. It still
needs additional external endpoints for updating and deleting objects
from the API, but it is otherwise complete. Further tasks include
writing an S3 adapter.
2024-10-09 14:43:06 +11:00

127 lines
2.6 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
username String @unique
admin Boolean @default(false)
email String
displayName String
profilePicture String // Object
authMecs LinkedAuthMec[]
clients Client[]
}
enum AuthMec {
Simple
}
model LinkedAuthMec {
userId String
mec AuthMec
credentials Json
user User @relation(fields: [userId], references: [id])
@@id([userId, mec])
}
enum ClientCapabilities {
DownloadAggregation
}
// References a device
model Client {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
endpoint String
capabilities ClientCapabilities[]
name String
platform String
lastConnected DateTime
}
enum MetadataSource {
Custom
GiantBomb
}
model Game {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
// Any field prefixed with m is filled in from metadata
// Acts as a cache so we can search and filter it
mName String // Name of game
mShortDescription String // Short description
mDescription String // Supports markdown
mDevelopers Developer[]
mPublishers Publisher[]
mReviewCount Int
mReviewRating Float
mIconId String // linked to objects in s3
mBannerId String // linked to objects in s3
mArt String[] // linked to objects in s3
mScreenshots String[] // linked to objects in s3
@@unique([metadataSource, metadataId], name: "metadataKey")
}
model Developer {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
mName String
mShortDescription String
mDescription String
mLogo String
mBanner String
mWebsite String
games Game[]
@@unique([metadataSource, metadataId], name: "metadataKey")
}
model Publisher {
id String @id @default(uuid())
metadataSource MetadataSource
metadataId String
mName String
mShortDescription String
mDescription String
mLogo String
mBanner String
mWebsite String
games Game[]
@@unique([metadataSource, metadataId], name: "metadataKey")
}