API: ajout /departement/<string:dept>/formsemestres_ids

This commit is contained in:
Emmanuel Viennet 2022-05-05 19:49:43 +02:00
parent f8a3ef8bb5
commit f2718635bb

View File

@ -89,6 +89,16 @@ def list_etudiants(dept_ident: str):
return jsonify([etud.to_dict_short() for etud in dept.etudiants]) return jsonify([etud.to_dict_short() for etud in dept.etudiants])
@bp.route("/departement/<string:dept_ident>/formsemestres_ids", methods=["GET"])
@token_auth.login_required
@token_permission_required(Permission.APIView)
def formsemestres_ids(dept_ident: str):
"""liste des ids formsemestre du département"""
# Le département, spécifié par un id ou un acronyme
dept = get_departement(dept_ident)
return jsonify([formsemestre.id for formsemestre in dept.formsemestres])
@bp.route("/departement/<string:dept_ident>/formsemestres_courants", methods=["GET"]) @bp.route("/departement/<string:dept_ident>/formsemestres_courants", methods=["GET"])
@token_auth.login_required @token_auth.login_required
@token_permission_required(Permission.APIView) @token_permission_required(Permission.APIView)