#65 endpoint to delete assignment
This commit was merged in pull request #69.
This commit is contained in:
@@ -242,3 +242,15 @@ def get_assignment(id):
|
|||||||
return error_response(400, f"Assignment with id {id} does not exist")
|
return error_response(400, f"Assignment with id {id} does not exist")
|
||||||
|
|
||||||
return jsonify(a.to_dict())
|
return jsonify(a.to_dict())
|
||||||
|
|
||||||
|
@bp.route("/assignment/<int:id>", methods=["DELETE"])
|
||||||
|
@login_required
|
||||||
|
def delete_assignment(id):
|
||||||
|
a = Assignment.query.get(id)
|
||||||
|
if not a:
|
||||||
|
return error_response(400, f"Assignment with id {id} does not exist")
|
||||||
|
|
||||||
|
db.session.delete(a)
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify(a.to_dict())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user