Course content #72
@@ -149,6 +149,7 @@ def get_students_in_course(id):
|
|||||||
resp["students"].append(s.to_dict())
|
resp["students"].append(s.to_dict())
|
||||||
return jsonify(resp)
|
return jsonify(resp)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/course/<int:id>/content", methods=["GET"])
|
@bp.route("/course/<int:id>/content", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def get_content_in_course(id):
|
def get_content_in_course(id):
|
||||||
@@ -162,6 +163,7 @@ def get_content_in_course(id):
|
|||||||
resp["content"].append(c.to_dict())
|
resp["content"].append(c.to_dict())
|
||||||
return jsonify(resp)
|
return jsonify(resp)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/course/<int:id>/assignments", methods=["GET"])
|
@bp.route("/course/<int:id>/assignments", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def get_assignments_in_course(id):
|
def get_assignments_in_course(id):
|
||||||
@@ -315,3 +317,13 @@ def create_content():
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return jsonify(c.to_dict())
|
return jsonify(c.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/content/<int:id>", methods=["GET"])
|
||||||
|
@login_required
|
||||||
|
def get_content(id):
|
||||||
|
c = Content.query.get(id)
|
||||||
|
if not c:
|
||||||
|
return error_response(400, f"Content with id {id} does not exist")
|
||||||
|
|
||||||
|
return jsonify(c.to_dict())
|
||||||
|
|||||||
Reference in New Issue
Block a user