diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-02-22 12:48:38 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-02-22 12:48:38 +0100 |
commit | 32aaaf92f2c06214abdc93e3cede07e067df6b88 (patch) | |
tree | 1b98d9e7605278311aa76880614ba17361f69285 /api/game/new.py | |
parent | ae4e74ccde82388cca5e874539bb132e23fc1e92 (diff) |
added columns to games + cleanup function
Diffstat (limited to 'api/game/new.py')
-rw-r--r-- | api/game/new.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/api/game/new.py b/api/game/new.py deleted file mode 100644 index 1b63110..0000000 --- a/api/game/new.py +++ /dev/null @@ -1,25 +0,0 @@ -from flask import Blueprint, request, make_response -from db import cursor, connection -from randid import new_uuid -import time -import json - -new_game = Blueprint('new', __name__) - -@new_game.route('/new', methods = ['POST']) -def index(): - data = request.get_json() - - user_id = data.get("user_id") or "" # maybe set up a temporary user here? - game_settings = data.get("settings") or "" - - if not user_id: - print("a temporary user should be set up here") - - game_id = new_uuid("games") - timestamp = int( time.time() * 1000 ) - - cursor.execute("insert into games values (?, NULL, NULL, ?, NULL, NULL, ?, NULL, NULL, NULL, \"wait_for_opponent\", ?, TRUE) ", (game_id, user_id, timestamp, json.dumps(game_settings))) - connection.commit() - - return { "id": game_id }, 200 |