示例#1
0
def end_search(search_uuid):
    search = get_search_by_uuid(search_uuid)
    data = request.get_json()
    end_time = data.get("end_time")
    notes = data.get("notes")
    search.end(end_time, notes)

    return jsonify({}), 202
示例#2
0
def create_radio_assignment(search_uuid):
    data = request.get_json()
    search = get_search_by_uuid(search_uuid)
    call_sign = data.get("call_sign")
    tetra_number = data.get("tetra_number")
    name = data.get("name")
    assignment = new_radio_assignment(search, call_sign, tetra_number, name)

    return jsonify({"id": assignment.uuid}), 201
示例#3
0
def create_comms_log(search_uuid):
    search = get_search_by_uuid(search_uuid)
    data = request.get_json()
    time = data.get("time")
    call_sign = data.get("call_sign")
    message = data.get("message")
    action = data.get("action")
    log = add_comms_log(search, time, call_sign, message, action)

    return jsonify({"id": log.uuid}), 201
示例#4
0
def create_search_log(search_uuid):
    data = request.get_json()
    search = get_search_by_uuid(search_uuid)
    team = data.get("team")
    area = data.get("area")
    start_time = data.get("start_time")
    end_time = data.get("end_time")
    notes = data.get("notes")
    log = new_search_log(search, team, area, start_time, end_time, notes)

    return jsonify({"id": log.uuid}), 201
示例#5
0
def update_search_log(search_uuid, log_uuid):
    data = request.get_json()
    search = get_search_by_uuid(search_uuid)
    log = get_search_log_by_uuid(log_uuid, search.id)
    log.update({
        "team": data.get("team"),
        "area": data.get("area"),
        "start_time": data.get("start_time"),
        "end_time": data.get("end_time"),
        "notes": data.get("notes"),
    })

    return jsonify({}), 202
示例#6
0
def update_search_team(search_uuid, team_uuid):
    data = request.get_json()
    search = get_search_by_uuid(search_uuid)
    team = get_team_by_uuid(team_uuid, search.id)
    team.update({
        "name": data.get("name"),
        "team_leader": data.get("team_leader"),
        "medic": data.get("medic"),
        "responder_1": data.get("responder_1"),
        "responder_2": data.get("responder_2"),
        "responder_3": data.get("responder_1"),
    })

    return jsonify({}), 202
示例#7
0
def add_search_team(search_uuid):
    search = get_search_by_uuid(search_uuid)
    data = request.get_json()
    name = data.get("name")
    team_leader = data.get("team_leader")
    medic = data.get("medic")
    responder_1 = data.get("responder_1")
    responder_2 = data.get("responder_2")
    responder_3 = data.get("responder_3")

    team = add_team(search, name, team_leader, medic, responder_1, responder_2,
                    responder_3)

    return jsonify({"id": team.uuid}), 201
示例#8
0
def get_search_teams_list(search_uuid):
    search = get_search_by_uuid(search_uuid)
    teams = search.teams.all()
    return jsonify(search_teams_schema.dump(teams))
示例#9
0
def get_search(uuid):
    search = get_search_by_uuid(uuid)
    return jsonify(search_schema.dump(search))
示例#10
0
def get_comms_logs(search_uuid):
    search = get_search_by_uuid(search_uuid)
    logs = search.comms_log.all()

    return jsonify(comms_logs_schema.dump(logs)), 200
示例#11
0
def get_radio_assignments(search_uuid):
    search = get_search_by_uuid(search_uuid)
    assignments = search.radios.all()
    return jsonify(radio_assignments_schema.dump(assignments)), 200
示例#12
0
def get_search_logs_list(search_uuid):
    search = get_search_by_uuid(search_uuid)
    logs = search.search_log.all()
    return jsonify(search_logs_schema.dump(logs))