diff --git a/backend/app/routes.py b/backend/app/routes.py index b90a347..39e3f24 100644 --- a/backend/app/routes.py +++ b/backend/app/routes.py @@ -242,3 +242,15 @@ def get_assignment(id): return error_response(400, f"Assignment with id {id} does not exist") return jsonify(a.to_dict()) + +@bp.route("/assignment/", 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()) +