#53 Endpoint to get an assignment by id
This commit was merged in pull request #60.
This commit is contained in:
@@ -233,3 +233,12 @@ def create_assignment():
|
||||
db.session.add(a)
|
||||
db.session.commit()
|
||||
return jsonify(a.to_dict())
|
||||
|
||||
@bp.route("/assignment/<int:id>", methods=["GET"])
|
||||
@login_required
|
||||
def get_assignment(id):
|
||||
a = Assignment.query.get(id)
|
||||
if not a:
|
||||
return error_response(400, f"Assignment with id {id} does not exist")
|
||||
|
||||
return jsonify(a.to_dict())
|
||||
|
||||
Reference in New Issue
Block a user