1+ from typing import TYPE_CHECKING
2+
13from sqlalchemy import BigInteger , Boolean , ForeignKey , Index , String , text
24from sqlalchemy .orm import Mapped , mapped_column , relationship
35
4- from api .models .orm import Jam , User , team_has_users_table
56from api .models .orm .base import Base
7+ from api .models .orm .team_has_users import team_has_users_table
8+
9+ if TYPE_CHECKING :
10+ from api .models .orm import User
611
712
813class Team (Base ):
@@ -11,17 +16,17 @@ class Team(Base):
1116 __tablename__ = "teams"
1217
1318 team_id : Mapped [int ] = mapped_column (primary_key = True )
14- jam_id : Mapped [int ] = mapped_column (ForeignKey (Jam .jam_id ))
15- leader_id : Mapped [int ] = mapped_column (ForeignKey (User .user_id ))
19+ jam_id : Mapped [int ] = mapped_column (ForeignKey ("jams .jam_id" ))
20+ leader_id : Mapped [int ] = mapped_column (ForeignKey ("users .user_id" ))
1621 name : Mapped [str ] = mapped_column (String (), nullable = False )
1722 discord_role_id : Mapped [int ] = mapped_column (BigInteger )
1823 discord_channel_id : Mapped [int ] = mapped_column (BigInteger )
1924
2025 winner : Mapped [bool ] = mapped_column (Boolean , nullable = True )
2126 first_place_winner : Mapped [bool ] = mapped_column (Boolean , nullable = True )
2227
23- users : Mapped [list [User ]] = relationship (
28+ users : Mapped [list [" User" ]] = relationship (
2429 secondary = team_has_users_table ,
2530 back_populates = "teams" ,
2631 )
27- __table_args__ = Index ("team_name_jam_unique" , text ("lower(name)" ), "jam_id" , unique = True )
32+ __table_args__ = ( Index ("team_name_jam_unique" , text ("lower(name)" ), "jam_id" , unique = True ), )
0 commit comments