Ejemplo n.º 1
0
 def upsert_club(self, club_id: int, club: Club, free_players: list):
     with session_scope(self.get_session) as session:
         if club_id:
             club.id = club_id
             club.update(session)
         else:
             club.add(session)
             session.refresh(club)
             club_id = club.id
         for player_id in free_players:
             player = Player.get(session, player_id)
             player.club_id = club_id
Ejemplo n.º 2
0
 def get_player(self, player_id: int) -> Player:
     return Player.get(self.get_session(), player_id)