Files
library/api/prisma/schema.prisma
T
2026-02-04 13:45:47 -08:00

127 lines
3.2 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 = "mongodb"
url = env("DATABASE_URL")
}
model Game {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String
platform String?
status GameStatus
dateAdded DateTime @default(now())
dateCompleted DateTime?
rating Int? @db.Int @default(0)
notes String?
coverImage String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
}
enum GameStatus {
PLAYING
COMPLETED
BACKLOG
}
model Book {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String
author String
isbn String?
status BookStatus
dateAdded DateTime @default(now())
dateFinished DateTime?
rating Int? @db.Int @default(0)
notes String?
coverImage String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
}
enum BookStatus {
READING
FINISHED
TO_READ
}
model Music {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String
artist String
type MusicType
status MusicStatus
dateAdded DateTime @default(now())
dateCompleted DateTime?
rating Int? @db.Int @default(0)
notes String?
coverArt String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
}
enum MusicType {
ALBUM
SINGLE
EP
}
enum MusicStatus {
LISTENING
COMPLETED
WANT_TO_LISTEN
}
model Art {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String
artist String
description String?
imageUrl String
dateAdded DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
discordId String @unique
username String
email String @unique
avatar String?
isAdmin Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
}
model Comment {
id String @id @default(auto()) @map("_id") @db.ObjectId
content String
userId String @db.ObjectId
user User @relation(fields: [userId], references: [id])
gameId String? @db.ObjectId
game Game? @relation(fields: [gameId], references: [id])
bookId String? @db.ObjectId
book Book? @relation(fields: [bookId], references: [id])
musicId String? @db.ObjectId
music Music? @relation(fields: [musicId], references: [id])
artId String? @db.ObjectId
art Art? @relation(fields: [artId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}