From 53f3ec72945634cc02d884102e800288d7a62b52 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Mon, 16 May 2022 15:14:51 +0200 Subject: [PATCH] correction des pluriels dans les routes --- app/api/etudiants.py | 53 +++++++++++++++++++++++++++++++++++-------- app/api/partitions.py | 4 ++-- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/app/api/etudiants.py b/app/api/etudiants.py index a193553f..76dd2347 100644 --- a/app/api/etudiants.py +++ b/app/api/etudiants.py @@ -20,11 +20,11 @@ from app.scodoc import sco_groups from app.scodoc.sco_permissions import Permission -@bp.route("/etudiants/courant", defaults={"long": False}) -@bp.route("/etudiants/courant/long", defaults={"long": True}) +@bp.route("/etudiants/courants", defaults={"long": False}) +@bp.route("/etudiants/courants/long", defaults={"long": True}) @token_auth.login_required @token_permission_required(Permission.APIView) -def etudiants_courant(long=False): +def etudiants_courants(long=False): """ Liste des étudiants inscrits dans un formsemestre actuellement en cours. @@ -236,41 +236,74 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None) @bp.route( "/etudiant/etudid//formsemestre//bulletin", methods=["GET"], - defaults={"version": "long"}, + defaults={"version": "long", "pdf": False}, ) @bp.route( "/etudiant/nip//formsemestre//bulletin", methods=["GET"], - defaults={"version": "long"}, + defaults={"version": "long", "pdf": False}, ) @bp.route( "/etudiant/ine//formsemestre//bulletin", methods=["GET"], - defaults={"version": "long"}, + defaults={"version": "long", "pdf": False}, ) +# Version PDF non fonctionnelle +# @bp.route( +# "/etudiant/etudid//formsemestre//bulletin/pdf", +# methods=["GET"], +# defaults={"version": "long", "pdf": True}, +# ) +# @bp.route( +# "/etudiant/nip//formsemestre//bulletin/pdf", +# methods=["GET"], +# defaults={"version": "long", "pdf": True}, +# ) +# @bp.route( +# "/etudiant/ine//formsemestre//bulletin/pdf", +# methods=["GET"], +# defaults={"version": "long", "pdf": True}, +# ) @bp.route( "/etudiant/etudid//formsemestre//bulletin/short", methods=["GET"], - defaults={"version": "short"}, + defaults={"version": "short", "pdf": False}, ) @bp.route( "/etudiant/nip//formsemestre//bulletin/short", methods=["GET"], - defaults={"version": "short"}, + defaults={"version": "short", "pdf": False}, ) @bp.route( "/etudiant/ine//formsemestre//bulletin/short", methods=["GET"], - defaults={"version": "short"}, + defaults={"version": "short", "pdf": False}, ) +# Version PDF non fonctionnelle +# @bp.route( +# "/etudiant/etudid//formsemestre//bulletin/short/pdf", +# methods=["GET"], +# defaults={"version": "short", "pdf": True}, +# ) +# @bp.route( +# "/etudiant/nip//formsemestre//bulletin/short/pdf", +# methods=["GET"], +# defaults={"version": "short", "pdf": True}, +# ) +# @bp.route( +# "/etudiant/ine//formsemestre//bulletin/short/pdf", +# methods=["GET"], +# defaults={"version": "short", "pdf": True}, +# ) @token_auth.login_required @token_permission_required(Permission.APIView) -def etudiant_bulletin_semestre( +def etudiant_bulletin_semestre( # XXX TODO Ajouter la possibilité de retourner en version pdf formsemestre_id, etudid: int = None, nip: str = None, ine: str = None, version="long", + # pdf: bool = False, ): """ Retourne le bulletin d'un étudiant en fonction de son id et d'un semestre donné diff --git a/app/api/partitions.py b/app/api/partitions.py index 1ee74c46..8ab9a4da 100644 --- a/app/api/partitions.py +++ b/app/api/partitions.py @@ -52,8 +52,8 @@ def partition(formsemestre_id: int): return jsonify(data) -@bp.route("/partitions/groups/", methods=["GET"]) -@bp.route("/partitions/groups//etat/", methods=["GET"]) +@bp.route("/partition/group/", methods=["GET"]) +@bp.route("/partition/group//etat/", methods=["GET"]) @token_auth.login_required @token_permission_required(Permission.APIView) def etud_in_group(group_id: int, etat=None):