Added refs
This commit is contained in:
+18
-37
@@ -70,51 +70,32 @@ class Match(Base):
|
||||
|
||||
bracket_type: Mapped[BracketTypes] = mapped_column(SqlEnum(BracketTypes))
|
||||
|
||||
court_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey("courts.id"), nullable=True
|
||||
)
|
||||
court_id: Mapped[Optional[int]] = mapped_column(ForeignKey("courts.id"), nullable=True)
|
||||
start_time: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
|
||||
status: Mapped[MatchStatus] = mapped_column(
|
||||
SqlEnum(MatchStatus), default=MatchStatus.SCHEDULED
|
||||
)
|
||||
status: Mapped[MatchStatus] = mapped_column(SqlEnum(MatchStatus), default=MatchStatus.SCHEDULED)
|
||||
|
||||
p1_team_id: Mapped[Optional[int]] = mapped_column(ForeignKey("teams.id"), nullable=True)
|
||||
p2_team_id: Mapped[Optional[int]] = mapped_column(ForeignKey("teams.id"), nullable=True)
|
||||
|
||||
ref_team_id: Mapped[Optional[int]] = mapped_column(ForeignKey("teams.id"), nullable=True)
|
||||
ref_label: Mapped[Optional[str]] = mapped_column(String, nullable=True)
|
||||
|
||||
p1_team_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey("teams.id"), nullable=True
|
||||
)
|
||||
p2_team_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey("teams.id"), nullable=True
|
||||
)
|
||||
sets: Mapped[list[dict]] = mapped_column(JSON, default=list)
|
||||
winner_team_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey("teams.id"), nullable=True
|
||||
)
|
||||
winner_next_match_id: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("matches.id"), nullable=True
|
||||
)
|
||||
loser_next_match_id: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("matches.id"), nullable=True
|
||||
)
|
||||
winner_team_id: Mapped[Optional[int]] = mapped_column(ForeignKey("teams.id"), nullable=True)
|
||||
|
||||
winner_next_match_id: Mapped[Optional[str]] = mapped_column(ForeignKey("matches.id"), nullable=True)
|
||||
winner_next_match_slot: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
|
||||
winner_next_match_id: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("matches.id"), nullable=True
|
||||
)
|
||||
winner_next_match_slot: Mapped[Optional[int]] = mapped_column(
|
||||
Integer, nullable=True
|
||||
)
|
||||
|
||||
loser_next_match_id: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("matches.id"), nullable=True
|
||||
)
|
||||
loser_next_match_id: Mapped[Optional[str]] = mapped_column(ForeignKey("matches.id"), nullable=True)
|
||||
loser_next_match_slot: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
|
||||
tournament: Mapped["Tournament"] = relationship(back_populates="matches")
|
||||
court: Mapped[Optional["Court"]] = relationship()
|
||||
p1_team: Mapped["Team"] = relationship("Team", foreign_keys=[p1_team_id])
|
||||
p2_team: Mapped["Team"] = relationship("Team", foreign_keys=[p2_team_id])
|
||||
winner_next_match: Mapped["Match"] = relationship(
|
||||
"Match", remote_side=[id], foreign_keys=[winner_next_match_id]
|
||||
)
|
||||
loser_next_match: Mapped["Match"] = relationship(
|
||||
"Match", remote_side=[id], foreign_keys=[loser_next_match_id]
|
||||
)
|
||||
|
||||
ref_team: Mapped[Optional["Team"]] = relationship("Team", foreign_keys=[ref_team_id])
|
||||
|
||||
winner_next_match: Mapped["Match"] = relationship("Match", remote_side=[id], foreign_keys=[winner_next_match_id])
|
||||
loser_next_match: Mapped["Match"] = relationship("Match", remote_side=[id], foreign_keys=[loser_next_match_id])
|
||||
Reference in New Issue
Block a user