Beispiel #1
0
def send_game_answer():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))

    json_data = request.json
    id_user = session_to_id_user(request.headers)
    json_data['id_user'] = id_user
    return make_response(jsonify(Processor().send_game_answer(json_data)))
def profile(id_user):
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    answer = Processor().profile(id_user)
    if answer:
        answer = answer[0]
    else:
        answer = {}
    return make_response(jsonify(answer))
Beispiel #3
0
def all_rating():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    id_user = session_to_id_user(request.headers) or None
    top = Processor().get_top_users(id_user)
    func = {
        'top': top
    }
    answer = jsonify(func)
    return make_response(answer)
Beispiel #4
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)))
def profile_user():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    id_user = session_to_id_user(request.headers)
    answer = Processor().profile(id_user)
    if answer:
        answer = answer[0]
    else:
        answer = {}
    return make_response(jsonify(answer))
def register():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    data = request.json
    res = Processor().create(data)
    return make_response(jsonify(res))
def login():
    if request.method == 'OPTIONS':
        return make_response(jsonify({}))
    data = request.json
    res = Processor().login(data)
    return make_response(jsonify(res))
def all_user():
    return make_response(jsonify(Processor().users()))