feat: Implement tournament schedule tab and fix E2E tests #27
+50
-65
@@ -7,32 +7,34 @@ datasource db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Player {
|
model Player {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String
|
||||||
rating Int @default(0)
|
rating Int @default(0)
|
||||||
currentElo Int @default(1000)
|
currentElo Int @default(1000)
|
||||||
gamesPlayed Int @default(0)
|
gamesPlayed Int @default(0)
|
||||||
wins Int @default(0)
|
wins Int @default(0)
|
||||||
losses Int @default(0)
|
losses Int @default(0)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
normalizedName String @unique
|
normalizedName String @unique
|
||||||
eloSnapshots EloSnapshot[]
|
eloSnapshots EloSnapshot[]
|
||||||
eventParticipants EventParticipant[]
|
eventParticipants EventParticipant[]
|
||||||
matchesAsP1 Match[] @relation("MatchPlayer1")
|
matchesAsP1 Match[] @relation("MatchPlayer1")
|
||||||
matchesAsP2 Match[] @relation("MatchPlayer2")
|
matchesAsP2 Match[] @relation("MatchPlayer2")
|
||||||
matchesAsP3 Match[] @relation("MatchPlayer3")
|
matchesAsP3 Match[] @relation("MatchPlayer3")
|
||||||
matchesAsP4 Match[] @relation("MatchPlayer4")
|
matchesAsP4 Match[] @relation("MatchPlayer4")
|
||||||
partnershipGames PartnershipGame[] @relation("PartnershipPlayer1")
|
partnershipGames PartnershipGame[] @relation("PartnershipPlayer1")
|
||||||
partnershipGames2 PartnershipGame[] @relation("PartnershipPlayer2")
|
partnershipGames2 PartnershipGame[] @relation("PartnershipPlayer2")
|
||||||
partnershipStats PartnershipStat[] @relation("StatPlayer1")
|
partnershipStats PartnershipStat[] @relation("StatPlayer1")
|
||||||
partnershipStats2 PartnershipStat[] @relation("StatPlayer2")
|
partnershipStats2 PartnershipStat[] @relation("StatPlayer2")
|
||||||
teamsAsPlayer1 Team[] @relation("TeamPlayer1")
|
user User?
|
||||||
teamsAsPlayer2 Team[] @relation("TeamPlayer2")
|
eloRating EloRating?
|
||||||
user User?
|
glicko2Rating Glicko2Rating?
|
||||||
eloRating EloRating?
|
openSkillRating OpenSkillRating?
|
||||||
glicko2Rating Glicko2Rating?
|
bracketMatchupsAsP1P1 BracketMatchup[] @relation("BracketMatchupPlayer1P1")
|
||||||
openSkillRating OpenSkillRating?
|
bracketMatchupsAsP1P2 BracketMatchup[] @relation("BracketMatchupPlayer1P2")
|
||||||
|
bracketMatchupsAsP2P1 BracketMatchup[] @relation("BracketMatchupPlayer2P1")
|
||||||
|
bracketMatchupsAsP2P2 BracketMatchup[] @relation("BracketMatchupPlayer2P2")
|
||||||
|
|
||||||
@@map("players")
|
@@map("players")
|
||||||
}
|
}
|
||||||
@@ -76,16 +78,15 @@ model Event {
|
|||||||
participants EventParticipant[]
|
participants EventParticipant[]
|
||||||
owner User? @relation("TournamentOwner", fields: [ownerId], references: [id])
|
owner User? @relation("TournamentOwner", fields: [ownerId], references: [id])
|
||||||
matches Match[]
|
matches Match[]
|
||||||
teams Team[]
|
|
||||||
rounds TournamentRound[]
|
rounds TournamentRound[]
|
||||||
|
|
||||||
// Team configuration fields
|
// Team configuration fields
|
||||||
teamDurability String @default("permanent") // permanent, variable, per_round
|
teamDurability String @default("permanent") // permanent, variable, per_round
|
||||||
partnerRotation String @default("none") // none, minimize_repeat, maximize_even, elo_based
|
partnerRotation String @default("none") // none, minimize_repeat, maximize_even, elo_based
|
||||||
allowByes Boolean @default(true)
|
allowByes Boolean @default(true)
|
||||||
teamConfiguration Json? // Additional configuration options
|
teamConfiguration Json? // Additional configuration options
|
||||||
maxRosterChanges Int? // Maximum roster changes per player
|
maxRosterChanges Int? // Maximum roster changes per player
|
||||||
requireAdminVerify Boolean @default(false) // For match score verification
|
requireAdminVerify Boolean @default(false) // For match score verification
|
||||||
|
|
||||||
@@map("events")
|
@@map("events")
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,6 @@ model EventParticipant {
|
|||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
eventId Int
|
eventId Int
|
||||||
playerId Int
|
playerId Int
|
||||||
teamId Int?
|
|
||||||
seed Int?
|
seed Int?
|
||||||
status String @default("registered")
|
status String @default("registered")
|
||||||
registrationDate DateTime?
|
registrationDate DateTime?
|
||||||
@@ -102,30 +102,11 @@ model EventParticipant {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
event Event @relation(fields: [eventId], references: [id])
|
event Event @relation(fields: [eventId], references: [id])
|
||||||
player Player @relation(fields: [playerId], references: [id])
|
player Player @relation(fields: [playerId], references: [id])
|
||||||
team Team? @relation(fields: [teamId], references: [id])
|
|
||||||
|
|
||||||
@@unique([eventId, playerId])
|
@@unique([eventId, playerId])
|
||||||
@@map("event_participants")
|
@@map("event_participants")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Team {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
eventId Int
|
|
||||||
teamName String?
|
|
||||||
player1Id Int
|
|
||||||
player2Id Int
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
updatedAt DateTime @updatedAt
|
|
||||||
bracketMatchups1 BracketMatchup[] @relation("BracketTeam1")
|
|
||||||
bracketMatchups2 BracketMatchup[] @relation("BracketTeam2")
|
|
||||||
eventParticipants EventParticipant[]
|
|
||||||
event Event @relation(fields: [eventId], references: [id])
|
|
||||||
player1 Player @relation("TeamPlayer1", fields: [player1Id], references: [id])
|
|
||||||
player2 Player @relation("TeamPlayer2", fields: [player2Id], references: [id])
|
|
||||||
|
|
||||||
@@map("teams")
|
|
||||||
}
|
|
||||||
|
|
||||||
model TournamentRound {
|
model TournamentRound {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
eventId Int
|
eventId Int
|
||||||
@@ -146,8 +127,10 @@ model BracketMatchup {
|
|||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
roundId Int
|
roundId Int
|
||||||
eventId Int
|
eventId Int
|
||||||
team1Id Int?
|
player1P1Id Int?
|
||||||
team2Id Int?
|
player1P2Id Int?
|
||||||
|
player2P1Id Int?
|
||||||
|
player2P2Id Int?
|
||||||
matchId Int?
|
matchId Int?
|
||||||
tableNumber Int?
|
tableNumber Int?
|
||||||
bracketPosition Int?
|
bracketPosition Int?
|
||||||
@@ -159,8 +142,10 @@ model BracketMatchup {
|
|||||||
event Event @relation(fields: [eventId], references: [id])
|
event Event @relation(fields: [eventId], references: [id])
|
||||||
match Match? @relation(fields: [matchId], references: [id], onDelete: Cascade)
|
match Match? @relation(fields: [matchId], references: [id], onDelete: Cascade)
|
||||||
round TournamentRound @relation(fields: [roundId], references: [id])
|
round TournamentRound @relation(fields: [roundId], references: [id])
|
||||||
team1 Team? @relation("BracketTeam1", fields: [team1Id], references: [id])
|
player1P1 Player? @relation("BracketMatchupPlayer1P1", fields: [player1P1Id], references: [id])
|
||||||
team2 Team? @relation("BracketTeam2", fields: [team2Id], references: [id])
|
player1P2 Player? @relation("BracketMatchupPlayer1P2", fields: [player1P2Id], references: [id])
|
||||||
|
player2P1 Player? @relation("BracketMatchupPlayer2P1", fields: [player2P1Id], references: [id])
|
||||||
|
player2P2 Player? @relation("BracketMatchupPlayer2P2", fields: [player2P2Id], references: [id])
|
||||||
|
|
||||||
@@map("bracket_matchups")
|
@@map("bracket_matchups")
|
||||||
}
|
}
|
||||||
@@ -169,10 +154,10 @@ model Match {
|
|||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
eventId Int?
|
eventId Int?
|
||||||
playedAt DateTime?
|
playedAt DateTime?
|
||||||
team1P1Id Int
|
player1P1Id Int?
|
||||||
team1P2Id Int
|
player1P2Id Int?
|
||||||
team2P1Id Int
|
player2P1Id Int?
|
||||||
team2P2Id Int
|
player2P2Id Int?
|
||||||
team1Score Int
|
team1Score Int
|
||||||
team2Score Int
|
team2Score Int
|
||||||
status String @default("completed")
|
status String @default("completed")
|
||||||
@@ -184,10 +169,10 @@ model Match {
|
|||||||
eloSnapshots EloSnapshot[]
|
eloSnapshots EloSnapshot[]
|
||||||
createdBy User? @relation("MatchCreator", fields: [createdById], references: [id])
|
createdBy User? @relation("MatchCreator", fields: [createdById], references: [id])
|
||||||
event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
||||||
team1P1 Player @relation("MatchPlayer1", fields: [team1P1Id], references: [id])
|
player1P1 Player? @relation("MatchPlayer1", fields: [player1P1Id], references: [id])
|
||||||
team1P2 Player @relation("MatchPlayer2", fields: [team1P2Id], references: [id])
|
player1P2 Player? @relation("MatchPlayer2", fields: [player1P2Id], references: [id])
|
||||||
team2P1 Player @relation("MatchPlayer3", fields: [team2P1Id], references: [id])
|
player2P1 Player? @relation("MatchPlayer3", fields: [player2P1Id], references: [id])
|
||||||
team2P2 Player @relation("MatchPlayer4", fields: [team2P2Id], references: [id])
|
player2P2 Player? @relation("MatchPlayer4", fields: [player2P2Id], references: [id])
|
||||||
partnershipGames PartnershipGame[]
|
partnershipGames PartnershipGame[]
|
||||||
|
|
||||||
@@map("matches")
|
@@map("matches")
|
||||||
|
|||||||
Reference in New Issue
Block a user