io
This commit is contained in:
@@ -35,6 +35,9 @@ enum MatchStatus {
|
||||
}
|
||||
|
||||
enum TeamStatus {
|
||||
PENDING
|
||||
APPROVED
|
||||
REJECTED
|
||||
ACTIVE
|
||||
INACTIVE
|
||||
}
|
||||
@@ -45,6 +48,12 @@ enum PaymentStatus {
|
||||
FAILED
|
||||
}
|
||||
|
||||
enum CardTier {
|
||||
BRONZE
|
||||
SILVER
|
||||
GOLD
|
||||
}
|
||||
|
||||
enum EventType {
|
||||
GOAL
|
||||
ASSIST
|
||||
@@ -92,20 +101,23 @@ model Group {
|
||||
}
|
||||
|
||||
model Player {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
image String? // نام فایل تصویر در public/uploads/players/
|
||||
position Position
|
||||
countryId String
|
||||
country Country @relation(fields: [countryId], references: [id])
|
||||
price Float @default(5.0)
|
||||
totalPoints Int @default(0)
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
matchStats PlayerMatchStat[]
|
||||
teamPlayers TeamPlayer[]
|
||||
events MatchEvent[]
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
image String? // نام فایل تصویر در public/uploads/players/
|
||||
position Position
|
||||
countryId String
|
||||
country Country @relation(fields: [countryId], references: [id])
|
||||
price Float @default(5.0)
|
||||
totalPoints Int @default(0)
|
||||
isActive Boolean @default(true)
|
||||
isGoldenCardEligible Boolean @default(false)
|
||||
cardTier CardTier @default(BRONZE)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
matchStats PlayerMatchStat[]
|
||||
teamPlayers TeamPlayer[]
|
||||
events MatchEvent[]
|
||||
goldenCards GoldenCard[]
|
||||
}
|
||||
|
||||
model Match {
|
||||
@@ -147,6 +159,15 @@ model Round {
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Gameweek {
|
||||
id String @id @default(cuid())
|
||||
number Int @unique
|
||||
name String
|
||||
isActive Boolean @default(false)
|
||||
deadline DateTime
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model MatchEvent {
|
||||
id String @id @default(cuid())
|
||||
matchId String
|
||||
@@ -202,15 +223,88 @@ model ScoringRule {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String @unique
|
||||
password String
|
||||
role Role @default(USER)
|
||||
createdAt DateTime @default(now())
|
||||
team Team?
|
||||
sessions Session[]
|
||||
payments Payment[]
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String @unique
|
||||
password String
|
||||
role Role @default(USER)
|
||||
createdAt DateTime @default(now())
|
||||
team Team?
|
||||
sessions Session[]
|
||||
payments Payment[]
|
||||
quizSubmissions QuizSubmission[]
|
||||
goldenCards GoldenCard[]
|
||||
}
|
||||
|
||||
enum GoldenCardStatus {
|
||||
SEALED
|
||||
OPENED
|
||||
}
|
||||
|
||||
enum SpecialCardState {
|
||||
IN_INVENTORY
|
||||
IN_TEAM
|
||||
SOLD
|
||||
}
|
||||
|
||||
model DailyQuiz {
|
||||
id String @id @default(cuid())
|
||||
date DateTime @db.Date
|
||||
windowStart DateTime
|
||||
windowEnd DateTime
|
||||
goldWinnersCount Int @default(1)
|
||||
silverWinnersCount Int @default(0)
|
||||
bronzeWinnersCount Int @default(0)
|
||||
goldMinCorrect Int?
|
||||
silverMinCorrect Int?
|
||||
bronzeMinCorrect Int?
|
||||
isProcessed Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
questions QuizQuestion[]
|
||||
submissions QuizSubmission[]
|
||||
awardedCards GoldenCard[]
|
||||
|
||||
@@unique([date])
|
||||
}
|
||||
|
||||
model QuizQuestion {
|
||||
id String @id @default(cuid())
|
||||
quizId String
|
||||
quiz DailyQuiz @relation(fields: [quizId], references: [id], onDelete: Cascade)
|
||||
questionText String
|
||||
options String[]
|
||||
correctAnswer Int // index of correct option (0-based)
|
||||
order Int @default(0)
|
||||
}
|
||||
|
||||
model QuizSubmission {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
quizId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
quiz DailyQuiz @relation(fields: [quizId], references: [id], onDelete: Cascade)
|
||||
answers Int[] // user's selected option indexes
|
||||
correctAnswers Int @default(0)
|
||||
score Int @default(0) // percentage 0-100
|
||||
submittedAt DateTime @default(now())
|
||||
|
||||
@@unique([userId, quizId])
|
||||
}
|
||||
|
||||
model GoldenCard {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
quizId String?
|
||||
playerId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
quiz DailyQuiz? @relation(fields: [quizId], references: [id], onDelete: SetNull)
|
||||
player Player @relation(fields: [playerId], references: [id], onDelete: Cascade)
|
||||
cardTier CardTier @default(GOLD)
|
||||
status GoldenCardStatus @default(SEALED)
|
||||
state SpecialCardState @default(IN_INVENTORY)
|
||||
acquiredDate DateTime @default(now())
|
||||
openedAt DateTime?
|
||||
teamPlayer TeamPlayer?
|
||||
}
|
||||
|
||||
model Session {
|
||||
@@ -237,12 +331,14 @@ model Team {
|
||||
model TeamPlayer {
|
||||
teamId String
|
||||
playerId String
|
||||
goldenCardId String? @unique
|
||||
isCaptain Boolean @default(false)
|
||||
isViceCaptain Boolean @default(false)
|
||||
isBench Boolean @default(false)
|
||||
positionIndex Int @default(0)
|
||||
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
player Player @relation(fields: [playerId], references: [id], onDelete: Cascade)
|
||||
goldenCard GoldenCard? @relation(fields: [goldenCardId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@id([teamId, playerId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user