// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { provider = "prisma-client" output = "./generated/prisma" } datasource db { provider = "sqlite" } enum Role { USER ADMIN } enum EventType { ATELIER KATA PRESENTATION LEARNING_HOUR } enum CharacterClass { WARRIOR MAGE ROGUE RANGER PALADIN ENGINEER MERCHANT SCHOLAR BERSERKER NECROMANCER } model User { id String @id @default(cuid()) email String @unique password String username String @unique role Role @default(USER) score Int @default(0) level Int @default(1) hp Int @default(1000) maxHp Int @default(1000) xp Int @default(0) maxXp Int @default(5000) avatar String? bio String? characterClass CharacterClass? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt preferences UserPreferences? eventRegistrations EventRegistration[] @@index([score]) @@index([email]) } model UserPreferences { id String @id @default(cuid()) userId String @unique user User @relation(fields: [userId], references: [id], onDelete: Cascade) // Background images for each page homeBackground String? eventsBackground String? leaderboardBackground String? // Other UI preferences can be added here theme String? @default("default") createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Event { id String @id @default(cuid()) date DateTime name String description String type EventType room String? time String? maxPlaces Int? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt registrations EventRegistration[] @@index([date]) } model EventRegistration { id String @id @default(cuid()) userId String eventId String user User @relation(fields: [userId], references: [id], onDelete: Cascade) event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) @@unique([userId, eventId]) @@index([userId]) @@index([eventId]) } model SitePreferences { id String @id @default("global") homeBackground String? eventsBackground String? leaderboardBackground String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }