Course content #72
@@ -327,3 +327,16 @@ def get_content(id):
|
|||||||
return error_response(400, f"Content with id {id} does not exist")
|
return error_response(400, f"Content with id {id} does not exist")
|
||||||
|
|
||||||
return jsonify(c.to_dict())
|
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())
|
||||||
|
|||||||
Reference in New Issue
Block a user