Merge pull request 'rectification de la route /departements' (#372) from leonard.montalbano/ScoDoc:new_api into new_api
Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/372
This commit is contained in:
commit
7010aefab3
@ -16,15 +16,32 @@ def departements():
|
||||
"""
|
||||
Retourne la liste des ids de départements visibles
|
||||
|
||||
Exemple de résultat : [2, 5, 8, 1, 4, 18]
|
||||
Exemple de résultat :
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"acronym": "TAPI",
|
||||
"description": null,
|
||||
"visible": true,
|
||||
"date_creation": "Fri, 15 Apr 2022 12:19:28 GMT"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"acronym": "MMI",
|
||||
"description": null,
|
||||
"visible": false,
|
||||
"date_creation": "Fri, 18 Apr 2022 11:20:8 GMT"
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
# Récupération de tous les départements
|
||||
depts = models.Departement.query.filter_by(visible=True)
|
||||
depts = models.Departement.query.all()
|
||||
|
||||
# Mise en place de la liste avec tous les ids de départements
|
||||
depts_ids = [d.id for d in depts]
|
||||
# Mise en place de la liste avec tous les départements
|
||||
data = [d.to_dict() for d in depts]
|
||||
|
||||
return jsonify(depts_ids)
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@bp.route("/departements/<string:dept>/etudiants/liste", methods=["GET"])
|
||||
|
Loading…
Reference in New Issue
Block a user