diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-04-15 15:14:44 +0200 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-04-15 15:14:44 +0200 |
commit | cc53f217f6122151bcae131a42da8f8887f8560d (patch) | |
tree | 2d09b9fd3758cecc00626c8aac31510dee7a37af /api/game/info.py | |
parent | c5f71bc38772dedb033258416e0cd722f7b9e7af (diff) |
new valid and util module, more function decorators
Diffstat (limited to 'api/game/info.py')
-rw-r--r-- | api/game/info.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/api/game/info.py b/api/game/info.py index 71fed2e..73c31ff 100644 --- a/api/game/info.py +++ b/api/game/info.py @@ -4,6 +4,7 @@ from db import cursor from user.info import format_user from rating import outcome from ruleset import resolve_ruleset +import valid def format_game(game_id, user_id=None): @@ -56,14 +57,6 @@ def format_game(game_id, user_id=None): } -# check if game_id exists in database -def valid_game_id(game_id): - query = cursor.execute( - "select game_id from games where game_id = ?", [game_id] - ).fetchone() - return bool(query) - - game_info = Blueprint('game_info', __name__) @@ -79,7 +72,7 @@ def index(): token = request.cookies.get("token") or "" if token: user_id = token_login(token) - if not valid_game_id(game_id): return "", 403 + if not valid.game_id(game_id): return "", 403 return format_game(game_id, user_id), 200 |