Exemplo n.º 1
0
def game_action():
    if request.method == 'OPTIONS':
        return {}, header_option()
    data = request.json
    check_session(data, request.headers)
    answer = jsonify(Processor().game_action(data))
    return answer, header_option()
Exemplo n.º 2
0
def get_game_info():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    if request.method == 'GET':
        id_user = session_to_id_user(request.headers)
        return make_response(jsonify(Processor().get_game_info(id_user)))
    if request.method == 'POST':
        data = request.json
        check_session(data, request.headers)
        return make_response(jsonify(Processor().start_new_game(data)))
Exemplo n.º 3
0
def game_main():
    answer = {}
    if request.method == 'OPTIONS':
        return {}, header_option()
    elif request.method == 'POST':
        data = request.json
        check_session(data, request.headers)
        answer = Processor().start_game(data)
        answer = Processor().get_game(data.get('id_user'))
    elif request.method == 'GET':
        id_user = session_to_id_user(request.headers)
        answer = Processor().get_game(id_user)
    answer = jsonify(answer)
    return answer, header_option()
Exemplo n.º 4
0
def swipe():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.json:
        data.update(request.json)
    return jsonify(Processor().swipe(data)), header_option()
Exemplo n.º 5
0
def login():
    if request.method == 'OPTIONS':
        print(request.method)
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.json:
        data.update(request.json)
    print(f'data = {data}')
    return jsonify(Processor().login(data)), header_option()
Exemplo n.º 6
0
def register():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    if request.method == 'GET':
        return jsonify(Processor().get_profile(data)), header_option()
    if request.json:
        data.update(request.json)
    print(f'data = {data}')
    return jsonify(Processor().update_profile(data)), header_option()
Exemplo n.º 7
0
def get_meeting():
    if request.method == 'OPTIONS':
        return jsonify({}), header_option()
    data = {'id': check_session(request.headers)}
    return jsonify(Processor().get_meeting(data)), header_option()