-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
from fastapi import Response | ||
from fastapi import Query, Response | ||
from fastapi.routing import APIRouter | ||
|
||
from src.dependencies.db import SessionDep | ||
from src.dependencies.facades import PokemonsFacadeDep | ||
from src.schemas.pokemons import PokemonFace | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/pokemons/{username}") | ||
async def get_pokemons_svg( | ||
username: str, | ||
session: SessionDep, | ||
pokemons_facade: PokemonsFacadeDep, | ||
username: str, session: SessionDep, pokemons_facade: PokemonsFacadeDep, face: PokemonFace = Query(PokemonFace.LEFT) | ||
): | ||
return Response( | ||
content=await pokemons_facade.render_pokemons(session=session, username=username), | ||
content=await pokemons_facade.render_pokemons(session=session, username=username, face=face), | ||
headers={"content-type": "image/svg+xml", "Cache-Control": "max-age=3600"}, | ||
) |
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,6 @@ | ||
from enum import Enum | ||
|
||
|
||
class PokemonFace(str, Enum): | ||
LEFT = "left" | ||
RIGHT = "right" |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.