#70 Add endpoint to get all content in a specific course
This commit is contained in:
@@ -149,6 +149,18 @@ 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"])
|
||||||
|
@login_required
|
||||||
|
def get_content_in_course(id):
|
||||||
|
c = Course.query.get(id)
|
||||||
|
if not c:
|
||||||
|
return error_response(400, f"course with id {id} not found")
|
||||||
|
|
||||||
|
content = c.content.all()
|
||||||
|
resp = {"content": []}
|
||||||
|
for c in content:
|
||||||
|
resp["content"].append(c.to_dict())
|
||||||
|
return jsonify(resp)
|
||||||
|
|
||||||
@bp.route("/course/<int:id>/assignments", methods=["GET"])
|
@bp.route("/course/<int:id>/assignments", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
Reference in New Issue
Block a user