107 lines
2.5 KiB
Plaintext
107 lines
2.5 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"
|
|
output = "./generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
}
|
|
|
|
enum EventType {
|
|
SUMMIT
|
|
LAUNCH
|
|
FESTIVAL
|
|
COMPETITION
|
|
}
|
|
|
|
enum EventStatus {
|
|
UPCOMING
|
|
LIVE
|
|
PAST
|
|
}
|
|
|
|
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?
|
|
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 String
|
|
name String
|
|
description String
|
|
type EventType
|
|
status EventStatus
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
registrations EventRegistration[]
|
|
|
|
@@index([status])
|
|
@@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
|
|
}
|