Spaces:
Running on T4
Running on T4
Download backend/app/modules/teams/repository.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 812 Bytes
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/teams/repository.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/teams/repository.py
-
curl -L -o repository.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/teams/repository.py
812 Bytes
| """Team queries, plus the account columns the teams module writes (coach name/focus, player team_id).""" | |
| from uuid import UUID | |
| from sqlalchemy import select | |
| from app.common.base_repository import BaseRepository | |
| from app.modules.accounts.models import Account | |
| from app.modules.teams.models import Team | |
| class TeamRepository(BaseRepository[Team]): | |
| model = Team | |
| async def by_code(self, code: str) -> Team | None: | |
| return await self.first_by(code=code) | |
| async def by_coach(self, coach_id: UUID) -> Team | None: | |
| return await self.first_by(coach_id=coach_id) | |
| async def coach_name(self, team: Team) -> str: | |
| return await self.session.scalar(select(Account.name).where(Account.id == team.coach_id)) or "" | |
| class MemberRepository(BaseRepository[Account]): | |
| model = Account | |