Course content #72

Merged
juggy1233 merged 6 commits from #70-course-content into master 2023-04-14 17:02:53 -04:00
Showing only changes of commit cab68b147c - Show all commits

View File

@@ -327,3 +327,16 @@ def get_content(id):
return error_response(400, f"Content with id {id} does not exist")
return jsonify(c.to_dict())
@bp.route("/content/<int:id>", methods=["DELETE"])
@login_required
@instructor_required
def delete_content(id):
c = Content.query.get(id)
if not c:
return error_response(400, f"Content with id {id} does not exist")
db.session.delete(c)
db.session.commit()
return jsonify(c.to_dict())