Add database and Prisma configurations, enhance event and leaderboard components with API integration, and update navigation for session management
This commit is contained in:
81
prisma/schema.prisma
Normal file
81
prisma/schema.prisma
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
preferences UserPreferences?
|
||||
|
||||
@@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
|
||||
|
||||
@@index([status])
|
||||
@@index([date])
|
||||
}
|
||||
Reference in New Issue
Block a user