-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
224 additions
and
29 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
backend/alembic/versions/19ddf67a4eeb_adding_teams_logo_paths.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Adding teams.logo_paths | ||
Revision ID: 19ddf67a4eeb | ||
Revises: c08e04993dd7 | ||
Create Date: 2024-02-24 12:14:16.037628 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str | None = "19ddf67a4eeb" | ||
down_revision: str | None = "c08e04993dd7" | ||
branch_labels: str | None = None | ||
depends_on: str | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column("teams", sa.Column("logo_path", sa.String(), nullable=True)) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("teams", "logo_path") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import aiofiles.os | ||
|
||
from bracket.sql.teams import get_team_by_id | ||
from bracket.utils.id_types import TeamId, TournamentId | ||
|
||
|
||
async def get_team_logo_path(tournament_id: TournamentId, team_id: TeamId) -> str | None: | ||
team = await get_team_by_id(team_id, tournament_id) | ||
logo_path = ( | ||
f"static/team-logos/{team.logo_path}" | ||
if team is not None and team.logo_path is not None | ||
else None # pylint: disable=line-too-long | ||
) | ||
return logo_path if logo_path is not None and await aiofiles.os.path.exists(logo_path) else None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.