示例#1
0
    def post(self):

        room = request.json

        if room is None:  # request body couldn't be parsed as JSON
            return jsonify({
                'title': 'Bad request',
                'msg': 'Invalid input data for room creation.'
            }), 400

        room_identifier = Database.create_room(room)

        return jsonify({"identifier": room_identifier}), 201
示例#2
0
from bluetato_server.database import Database

room_id = '1'
print("CREATE ", Database.create_room(3))

user_id = 'id1'
session_id = 's1'
name = 'A'
print("+-> ", Database.create_player(room_id, name, session_id, user_id))
print("Adding questions")
print(Database.player_enters_question(room_id, user_id, 'Qa'))
print(Database.player_enters_question(room_id, user_id, 'Qb'))
print(Database.player_enters_question(room_id, user_id, 'Qc'))
print("Ending questions")
print("SessionId ", Database.get_session_id(room_id, '1'))

user_id = 'id2'
session_id = 's2'
name = 'B'
print("+-> ", Database.create_player(room_id, name, session_id, user_id))
print("Adding questions")
print(Database.player_enters_question(room_id, user_id, 'Qd'))
print(Database.player_enters_question(room_id, user_id, 'Qe'))
print(Database.player_enters_question(room_id, user_id, 'Qf'))
print("Ending questions")

user_id = 'id3'
session_id = 's3'
name = 'C'
print("+-> ", Database.create_player(room_id, name, session_id, user_id))