This commit is contained in:
Eden Kirin
2023-03-26 14:37:39 +02:00
parent f54344a17f
commit 806a379253
7 changed files with 446 additions and 31 deletions

View File

@ -28,7 +28,7 @@ def get_player(uuid: str, engine: GameEngine = Depends(get_game_engine)) -> Play
)
if not player.active:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
status_code=status.HTTP_403_FORBIDDEN,
detail="Player kicked out due to inactivity",
)
return player
@ -73,6 +73,16 @@ async def start_game(
"/player/{uuid}",
response_model=PlayerInfoResponseDto,
status_code=status.HTTP_201_CREATED,
responses={
status.HTTP_403_FORBIDDEN: {
"model": ErrorResponseDto,
"description": " Player inactive",
},
status.HTTP_404_NOT_FOUND: {
"model": ErrorResponseDto,
"description": " Player with uuid not found, probably kicked out",
},
},
)
async def get_player_info(
player: Player = Depends(get_player),
@ -91,7 +101,11 @@ async def get_player_info(
},
status.HTTP_403_FORBIDDEN: {
"model": ErrorResponseDto,
"description": " Player uuid not valid, probably due to inactivity",
"description": " Player inactive",
},
status.HTTP_404_NOT_FOUND: {
"model": ErrorResponseDto,
"description": " Player with uuid not found, probably kicked out",
},
status.HTTP_409_CONFLICT: {
"model": ErrorResponseDto,