Skip to content

Commit

Permalink
Add async
Browse files Browse the repository at this point in the history
  • Loading branch information
s9891326 committed Sep 6, 2023
1 parent 314b831 commit 17dd4d6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions love_letter/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@


@app.post("/games/create/by_player/{player_id}")
def create_game(player_id: str) -> str:
async def create_game(player_id: str) -> str:
presenter = CreateGamePresenter.presenter()
CreateGame().execute(CreateGame.input(player_id), presenter)
return presenter.as_view_model()


@app.post("/games/{game_id}/player/{player_id}/join")
def join_game(game_id: str, player_id: str) -> bool:
async def join_game(game_id: str, player_id: str) -> bool:
presenter = JoinGamePresenter.presenter()
JoinGame().execute(JoinGame.input(game_id, player_id), presenter)
return presenter.as_view_model()


@app.post("/games/{game_id}/start")
def start_game(game_id: str):
async def start_game(game_id: str):
presenter = StartGamePresenter.presenter()
StartGame().execute(StartGame.input(game_id), presenter)
return presenter.as_view_model()
Expand All @@ -70,7 +70,7 @@ def start_game(game_id: str):
"/games/{game_id}/player/{player_id}/card/{card_name}/play",
response_model=GameStatus,
)
def play_card(
async def play_card(
game_id: str,
player_id: str,
card_name: str,
Expand All @@ -85,22 +85,22 @@ def play_card(


@app.get("/games/{game_id}/player/{player_id}/status", response_model=GameStatus)
def get_status(game_id: str, player_id: str):
async def get_status(game_id: str, player_id: str):
presenter = GetStatusPresenter.presenter()
GetStatus().execute(GetStatus.input(game_id, player_id), presenter)
game = presenter.as_view_model()
return build_player_view(game, player_id)


@app.post("/games", dependencies=[Depends(JWTBearer())])
def lobby_start_game(players: LobbyPlayers):
async def lobby_start_game(players: LobbyPlayers):
presenter = LobbyStartGamePresenter.presenter()
LobbyStartGame().execute(players, presenter)
return presenter.as_view_model()


@app.get("/heath")
def heath():
async def heath():
return {"success": True}


Expand Down

0 comments on commit 17dd4d6

Please sign in to comment.