mirror_match/prisma/schema.prisma
ilia 2169e5d184
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m21s
CI / lint-and-type-check (pull_request) Successful in 1m44s
CI / test (pull_request) Successful in 1m49s
CI / build (pull_request) Successful in 1m50s
CI / secret-scanning (pull_request) Successful in 1m22s
CI / dependency-scan (pull_request) Successful in 1m29s
CI / sast-scan (pull_request) Successful in 2m23s
CI / workflow-summary (pull_request) Successful in 1m19s
chore: Add postinstall script for Prisma client generation and remove outdated client symlink
- Introduce a postinstall script to automatically generate the Prisma client after installation
- Remove the outdated symlink for the Prisma client to streamline project structure and avoid confusion
2026-01-03 10:17:35 -05:00

69 lines
1.6 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
// Seed configuration
// Run with: npm run db:seed
model User {
id String @id @default(cuid())
name String
email String @unique
passwordHash String
role Role @default(USER)
points Int @default(0)
createdAt DateTime @default(now())
uploadedPhotos Photo[] @relation("PhotoUploader")
guesses Guess[]
@@index([points])
}
model Photo {
id String @id @default(cuid())
uploaderId String
uploader User @relation("PhotoUploader", fields: [uploaderId], references: [id])
url String
fileHash String? // SHA256 hash of file content (null for URL uploads)
answerName String
points Int @default(1)
penaltyEnabled Boolean @default(false)
penaltyPoints Int @default(0)
maxAttempts Int? // Maximum number of guesses allowed per user (null = unlimited)
createdAt DateTime @default(now())
guesses Guess[]
@@index([uploaderId])
@@index([createdAt])
@@index([url])
@@index([fileHash])
}
model Guess {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id])
photoId String
photo Photo @relation(fields: [photoId], references: [id])
guessText String
correct Boolean @default(false)
createdAt DateTime @default(now())
@@index([userId])
@@index([photoId])
}
enum Role {
ADMIN
USER
}