- Add admin page at /admin (restricted to ADMIN_EMAIL via proxy) - Implement user ban/unban and deletion - Add daily puzzle creation, modification, deletion - Include 14-day activity chart with hover details - Add User.banned field to schema and migrate database - Block banned users from logging in - Add ADMIN_EMAIL to .env.local configuration - Update Prisma client after schema changes
60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client"
|
|
output = "../lib/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid(7))
|
|
name String
|
|
email String @unique
|
|
password String
|
|
banned Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
games Game[]
|
|
dailyResults DailyResult[]
|
|
}
|
|
|
|
model Game {
|
|
id String @id @default(uuid(7))
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
mode String // "solo" | "multi" | "daily" | "blitz"
|
|
startArticle String
|
|
targetArticle String
|
|
path String // JSON array de titres
|
|
clicks Int
|
|
timeSeconds Float
|
|
won Boolean @default(true)
|
|
playedAt DateTime @default(now())
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model DailyPuzzle {
|
|
id String @id @default(uuid(7))
|
|
date String @unique // "YYYY-MM-DD"
|
|
startArticle String
|
|
targetArticle String
|
|
results DailyResult[]
|
|
}
|
|
|
|
model DailyResult {
|
|
id String @id @default(uuid(7))
|
|
puzzleId String
|
|
puzzle DailyPuzzle @relation(fields: [puzzleId], references: [id], onDelete: Cascade)
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
path String // JSON
|
|
clicks Int
|
|
timeSeconds Float
|
|
won Boolean
|
|
playedAt DateTime @default(now())
|
|
|
|
@@unique([puzzleId, userId])
|
|
@@index([puzzleId])
|
|
}
|