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()
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()
def login(): if request.method == 'OPTIONS': print(request.method) return jsonify({}), header_option() data = request.json print(f'data = {data}') return jsonify(Processor().login(data)), header_option()
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()
def profile(id_user): if request.method == 'OPTIONS': print(request.method) return jsonify({}), header_option() answer = Processor().profile(id_user) if answer: answer = answer[0] else: answer = {} return jsonify(answer), header_option()
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()
def login(): if request.method == 'OPTIONS': print(request.method) return jsonify({}), header_option() data = request.json print(f'{dumps(data)}') if not data: return jsonify({}), header_option() file = Processor().create_file(data) pprint(file) return jsonify(file), header_option()
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()
def game_events(): func = { 'event': [{ 'element': 'DIV', # какой элемент изменился 'description': 'Пользователь заразился CoronaVirus' }] } # answer = jsonify(Processor().profile(id_user)) answer = jsonify(func) return answer, header_option()
def all_person(): func = { 'id_person': 1, 'name': 'Студент', 'description': 'Все мы немного студенты и хотим кушать', 'pic': 'https://emojio.ru/images/apple-b/1f468-200d-1f393.png', 'health': 10.0, # Здоровье 'food': 5.0, # Питание 'leisure': 3.0, # Досуг 'communication': 4.0, # Общение 'value': 3, # количество денег } return jsonify(Processor().all_person()), header_option()
def all_user(): return jsonify(Processor().users()), header_option()
def register(): if request.method == 'OPTIONS': return {}, header_option() data = request.json print(f'data = {data}') return jsonify(Processor().create(data)), header_option()
def all_rating(): top = Processor().get_top_users() func = {'top': top} answer = jsonify(func) return answer, header_option()
def test(): return jsonify(True), header_option()
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()