Skip to content

Commit

Permalink
Added 404 status code if entry is not found in database
Browse files Browse the repository at this point in the history
  • Loading branch information
BasMonkey committed Oct 18, 2024
1 parent dc0be3e commit f8dd6ba
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ExonCov/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def sample_by_id_api(sample_id):
"""
if get_sample_by_id(sample_id):
result = model_to_dict(get_sample_by_id(sample_id))
return jsonify(result)
else:
result = generate_not_found_dict()
return jsonify(result)

return jsonify(result), 404

@app.route('/api/samples/id/<sample_id>/panel/<panel_id>/qc')
@token_required
Expand All @@ -65,10 +65,9 @@ def sample_coverage_by_id_api(sample_id, panel_id):
if qc:
result = {"qc": qc}
result["qc"]["summary"] = get_summary_by_sample_id_and_panel_id(sample_id, panel_id, True)
return jsonify(result)
else:
result = generate_not_found_dict()

return jsonify(result)
return generate_not_found_dict(), 404


@app.route('/api/samples')
Expand Down

0 comments on commit f8dd6ba

Please sign in to comment.