Beispiel #1
0
def make_request():
    data = edict(request.get_json())  # data should only contain request type

    # Check that it is not the same request as an existing one (e.g same user, same room, same request)
    call_request = Request.query.filter_by(caller=current_user,
                                           room=current_user.room,
                                           request=data.request).first()
    if call_request is None:
        call_request = Request.add(current_user, data)

    response = jsonify({
        "request_id": call_request and call_request.id,
        "index": call_request and call_request.rank
    })

    Request.check_match_in_room(current_user.room)

    return response
Beispiel #2
0
def set_status():
    data = edict(request.get_json())
    current_user.set_status(data.status)
    if data.status == "free":
        Request.check_match_in_room(current_user.room)
    return jsonify({"status": current_user.status})