1
0
forked from ScoDoc/ScoDoc

ajout de la route /formations

This commit is contained in:
leonard_montalbano 2022-06-17 15:46:17 +02:00
parent 3a3c3793ed
commit 53a4b6cdd7

View File

@ -10,6 +10,22 @@ from app.models.formations import Formation
from app.scodoc import sco_formations
from app.scodoc.sco_permissions import Permission
@bp.route("/formations", methods=["GET"])
@token_auth.login_required
@token_permission_required(Permission.APIView)
def formations():
"""
Retourne la liste de toutes les formations (tous départements)
Exemple de résultat :
"""
# Récupération de toutes les formations
list_formations = models.Formation.query.all()
# Mise en forme des données
data = [d.to_dict() for d in list_formations]
return jsonify(data)
@bp.route("/formations_ids", methods=["GET"])
@token_auth.login_required