-
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.
Merge pull request #11 from The-Galley/fix/lobby-fix
Mini fixes
- Loading branch information
Showing
35 changed files
with
595 additions
and
147 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
from http import HTTPStatus | ||
|
||
from aiohttp.web import Response, View | ||
|
||
from industry_game.utils.games.models import NewGameModel | ||
from industry_game.utils.http.auth.base import ( | ||
AuthMixin, | ||
require_admin_authorization, | ||
) | ||
from industry_game.utils.http.deps import DependenciesMixin | ||
from industry_game.utils.http.params import parse_json_model | ||
from industry_game.utils.http.response import msgspec_json_response | ||
|
||
|
||
class CreateGameHandler(View, DependenciesMixin, AuthMixin): | ||
@require_admin_authorization | ||
async def post(self) -> Response: | ||
body = await self.request.read() | ||
new_game_data = parse_json_model(model=NewGameModel, data=body) | ||
|
||
game = await self.game_storage.create( | ||
name=new_game_data.name, | ||
description=new_game_data.description, | ||
created_by_id=self.user.id, | ||
) | ||
return msgspec_json_response(game, status=HTTPStatus.CREATED) |
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,20 @@ | ||
from aiohttp.web import Response, View | ||
|
||
from industry_game.utils.http.auth.base import ( | ||
AuthMixin, | ||
require_admin_authorization, | ||
) | ||
from industry_game.utils.http.deps import DependenciesMixin | ||
from industry_game.utils.http.models import StatusResponse | ||
from industry_game.utils.http.params import parse_path_param | ||
from industry_game.utils.http.response import msgspec_json_response | ||
|
||
|
||
class StartGameHandler(View, DependenciesMixin, AuthMixin): | ||
@require_admin_authorization | ||
async def post(self) -> Response: | ||
game_id = parse_path_param(self.request, "game_id", int) | ||
await self.game_store.start_game(game_id=game_id) | ||
return msgspec_json_response( | ||
StatusResponse(message=f"Game {game_id} was started") | ||
) |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Empty file.
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,2 @@ | ||
class District: | ||
pass |
Oops, something went wrong.