Better bracket logic
This commit is contained in:
+14
-26
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from .constants import BracketType, MatchSourceType, MatchStatus, TournamentTypes
|
||||
from .constants import MatchStatus, TournamentTypes, BracketTypes
|
||||
|
||||
|
||||
class TeamSchema(BaseModel):
|
||||
@@ -38,39 +38,26 @@ class ScoreReport(BaseModel):
|
||||
|
||||
class MatchOut(BaseModel):
|
||||
id: str
|
||||
node_id: str
|
||||
match_number: int
|
||||
round_number: int
|
||||
bracket_type: BracketTypes
|
||||
|
||||
status: MatchStatus
|
||||
timestamp: datetime | None = None
|
||||
court: CourtSchema | None = None
|
||||
p1_team: TeamSchema | None = None
|
||||
p2_team: TeamSchema | None = None
|
||||
start_time: datetime | None = None
|
||||
court_id: int | None = None
|
||||
|
||||
p1_team_id: int | None = None
|
||||
p2_team_id: int | None = None
|
||||
winner_team_id: int | None = None
|
||||
|
||||
winner_next_match_id: str | None = None
|
||||
loser_next_match_id: str | None = None
|
||||
|
||||
sets: list[SetScore] = []
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class BracketNodeOut(BaseModel):
|
||||
id: str
|
||||
display_number: int
|
||||
bracket_type: BracketType
|
||||
round_number: int
|
||||
planned_start_time: datetime | None = None
|
||||
planned_court_id: int | None = None
|
||||
source_p1_node_id: str | None = None
|
||||
source_p2_node_id: str | None = None
|
||||
source_p1_type: MatchSourceType | None = None
|
||||
source_p2_type: MatchSourceType | None = None
|
||||
winner_next_node_id: str | None = None
|
||||
loser_next_node_id: str | None = None
|
||||
p1_team: TeamSchema | None = None
|
||||
p2_team: TeamSchema | None = None
|
||||
match: MatchOut | None = None
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class TournamentCreate(BaseModel):
|
||||
name: str
|
||||
code: str
|
||||
@@ -106,6 +93,7 @@ class TournamentDetail(BaseModel):
|
||||
type: TournamentTypes
|
||||
teams: list[TeamSchema]
|
||||
courts: list[CourtSchema]
|
||||
matches: list[MatchOut]
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user