première phase implémentation api scodoc9
This commit is contained in:
parent
20c8f22c7b
commit
858b922b5a
2
.gitignore
vendored
2
.gitignore
vendored
@ -169,5 +169,7 @@ Thumbs.db
|
|||||||
.vscode/
|
.vscode/
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea/
|
||||||
|
|
||||||
copy
|
copy
|
||||||
|
@ -52,12 +52,13 @@ from app.models import FormSemestre, FormSemestreInscription, Identite
|
|||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
|
|
||||||
@bp.route("list_depts", methods=["GET"])
|
@bp.route("/list_depts", methods=["GET"])
|
||||||
@token_auth.login_required
|
@token_auth.login_required
|
||||||
def list_depts():
|
def list_depts():
|
||||||
depts = models.Departement.query.filter_by(visible=True).all()
|
depts = models.Departement.query.filter_by(visible=True).all()
|
||||||
data = [d.to_dict() for d in depts]
|
data = [d.to_dict() for d in depts]
|
||||||
return jsonify(data)
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/etudiants/courant", methods=["GET"])
|
@bp.route("/etudiants/courant", methods=["GET"])
|
||||||
@ -77,4 +78,424 @@ def etudiants():
|
|||||||
FormSemestre.date_debut <= func.now(),
|
FormSemestre.date_debut <= func.now(),
|
||||||
FormSemestre.date_fin >= func.now(),
|
FormSemestre.date_fin >= func.now(),
|
||||||
)
|
)
|
||||||
return jsonify([e.to_dict_bul(include_urls=False) for e in query])
|
# return jsonify([e.to_dict_bul(include_urls=False) for e in query])
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
######################## Departements ##################################
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/departements", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def departements():
|
||||||
|
"""
|
||||||
|
Liste des id de départements
|
||||||
|
"""
|
||||||
|
depts = models.Departement.query.filter_by(visible=True).all()
|
||||||
|
data = [d.to_dict() for d in depts]
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/departements/<string:dept>/etudiants/liste/<int:sem_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def liste_etudiants(dept, *args, sem_id):
|
||||||
|
"""
|
||||||
|
Liste des étudiants d'un département
|
||||||
|
"""
|
||||||
|
# Test si le sem_id à été renseigné ou non
|
||||||
|
if sem_id is not None:
|
||||||
|
# Récupération du/des depts
|
||||||
|
list_depts = models.Departement.query.filter(
|
||||||
|
models.Departement.acronym == dept,
|
||||||
|
models.FormSemestre.semestre_id == sem_id,
|
||||||
|
)
|
||||||
|
list_etuds = []
|
||||||
|
for dept in list_depts:
|
||||||
|
# Récupération des étudiants d'un département
|
||||||
|
x = models.Identite.query.filter(models.Identite.dept_id == dept.getId())
|
||||||
|
for y in x:
|
||||||
|
# Ajout des étudiants dans la liste global
|
||||||
|
list_etuds.append(y)
|
||||||
|
else:
|
||||||
|
list_depts = models.Departement.query.filter(
|
||||||
|
models.Departement.acronym == dept,
|
||||||
|
models.FormSemestre.semestre_id == models.Departement.formsemestres,
|
||||||
|
)
|
||||||
|
list_etuds = []
|
||||||
|
for dept in list_depts:
|
||||||
|
x = models.Identite.query.filter(models.Identite.dept_id == dept.getId())
|
||||||
|
for y in x:
|
||||||
|
list_etuds.append(y)
|
||||||
|
|
||||||
|
data = [d.to_dict() for d in list_etuds]
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/departements/<string:dept>/semestres_actifs", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def liste_semestres_actifs(dept):
|
||||||
|
"""
|
||||||
|
Liste des semestres actifs d'un départements donné
|
||||||
|
"""
|
||||||
|
# Récupération de l'id du dept
|
||||||
|
dept_id = models.Departement.query.filter(models.Departement.acronym == dept)
|
||||||
|
# Puis ici récupération du FormSemestre correspondant
|
||||||
|
depts_actifs = models.FormSemestre.query.filter_by(
|
||||||
|
etat=True,
|
||||||
|
dept_id=dept_id,
|
||||||
|
)
|
||||||
|
data = [da.to_dict() for da in depts_actifs]
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/departements/<string:dept>/formations/<int:formation>/referentiel_competences"
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def referenciel_competences(dept, formation):
|
||||||
|
"""
|
||||||
|
Le référenciel de compétences d'une formation donnée
|
||||||
|
"""
|
||||||
|
ref_comp = models.Formation.query.filter(
|
||||||
|
models.Departement.acronym == dept,
|
||||||
|
models.Formation.referentiel_competence_id == formation,
|
||||||
|
)
|
||||||
|
data = [d.to_dict() for d in ref_comp]
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
####################### Etudiants ##################################
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/etudiant/<int:etudid>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def etudiant(etudid):
|
||||||
|
"""
|
||||||
|
Un dictionnaire avec les informations de l'étudiant correspondant à l'id passé en paramètres.
|
||||||
|
"""
|
||||||
|
# return jsonify(models.Identite.query.filter_by(etudid=etudid))
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/etudiant/<int:etudid>/semestre/<int:sem_id>/bulletin", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def etudiant_bulletin_semestre(etudid, sem_id):
|
||||||
|
"""
|
||||||
|
Le bulletin d'un étudiant en fonction de son id et d'un semestre donné
|
||||||
|
"""
|
||||||
|
# return jsonify(models.BulAppreciations.query.filter_by(etudid=etudid, formsemestre_id=sem_id))
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:NIP>/releve",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/id/<int:etudid>/releve",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:numScodoc>/releve",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def etudiant_bulletin(formsemestre_id, dept, etudid, format="json", *args, size):
|
||||||
|
"""
|
||||||
|
Un bulletin de note
|
||||||
|
"""
|
||||||
|
formsemestres = models.FormSemestre.query.filter_by(id=formsemestre_id)
|
||||||
|
depts = models.Departement.query.filter_by(acronym=dept)
|
||||||
|
etud = ""
|
||||||
|
|
||||||
|
data = []
|
||||||
|
if args[0] == "short":
|
||||||
|
pass
|
||||||
|
elif args[0] == "selectevals":
|
||||||
|
pass
|
||||||
|
elif args[0] == "long":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return "erreur"
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/<int:etudid>/semestre/<int:formsemestre_id>/groups", methods=["GET"]
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def etudiant_groups(etudid: int, formsemestre_id: int):
|
||||||
|
"""
|
||||||
|
Liste des groupes auxquels appartient l'étudiant dans le semestre indiqué
|
||||||
|
"""
|
||||||
|
semestre = models.FormSemestre.query.filter_by(id=formsemestre_id)
|
||||||
|
etudiant = models.Identite.query.filter_by(id=etudid)
|
||||||
|
|
||||||
|
groups = models.Partition.query.filter(
|
||||||
|
models.Partition.formsemestre_id == semestre,
|
||||||
|
models.GroupDescr.etudiants == etudiant,
|
||||||
|
)
|
||||||
|
data = [d.to_dict() for d in groups]
|
||||||
|
# return jsonify(data)
|
||||||
|
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
#######################" Programmes de formations #########################
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/formations", methods=["GET"])
|
||||||
|
@bp.route("/formations/<int:formation_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def formations(formation_id: int):
|
||||||
|
"""
|
||||||
|
Liste des formations
|
||||||
|
"""
|
||||||
|
formations = models.Formation.query.filter_by(id=formation_id)
|
||||||
|
data = [d.to_dict() for d in formations]
|
||||||
|
# return jsonify(data)
|
||||||
|
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/formations/formation_export/<int:formation_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def formation_export(formation_id: int, export_ids=False):
|
||||||
|
"""
|
||||||
|
La formation, avec UE, matières, modules
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
###################### UE #######################################
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/departements/<string:dept>/formations/programme/<string:sem_id>", methods=["GET"]
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def eus(dept: str, sem_id: int):
|
||||||
|
"""
|
||||||
|
Liste des UES, ressources et SAE d'un semestre
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
######## Semestres de formation ###############
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/formations/formsemestre/<int:formsemestre_id>", methods=["GET"])
|
||||||
|
@bp.route("/formations/apo/<int:etape_apo>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def formsemestre(
|
||||||
|
id: int,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Information sur les formsemestres
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
############ Modules de formation ##############
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/formations/moduleimpl/<int:moduleimpl_id>", methods=["GET"])
|
||||||
|
@bp.route(
|
||||||
|
"/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def moduleimpl(id: int):
|
||||||
|
"""
|
||||||
|
Liste de moduleimpl
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
########### Groupes et partitions ###############
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/partitions/<int:formsemestre_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def partition(formsemestre_id: int):
|
||||||
|
"""
|
||||||
|
La liste de toutes les partitions d'un formsemestre
|
||||||
|
"""
|
||||||
|
partitions = models.Partition.query.filter_by(id=formsemestre_id)
|
||||||
|
data = [d.to_dict() for d in partitions]
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/partitions/formsemestre/<int:formsemestre_id>/groups/group_ids?with_codes=&all_groups=&etat=",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def groups(formsemestre_id: int, group_ids: int):
|
||||||
|
"""
|
||||||
|
Liste des étudiants dans un groupe
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/partitions/set_groups?partition_id=<int:partition_id>&groups=<int:groups>&groups_to_delete=<int:groups_to_delete>&groups_to_create=<int:groups_to_create>",
|
||||||
|
methods=["POST"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def set_groups(
|
||||||
|
partition_id: int, groups: int, groups_to_delete: int, groups_to_create: int
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Set les groups
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
####### Bulletins de notes ###########
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/evaluations/<int:moduleimpl_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def evaluations(moduleimpl_id: int):
|
||||||
|
"""
|
||||||
|
Liste des évaluations à partir de l'id d'un moduleimpl
|
||||||
|
"""
|
||||||
|
evals = models.Evaluation.query.filter_by(id=moduleimpl_id)
|
||||||
|
data = [d.to_dict() for d in evals]
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/evaluations/eval_notes/<int:evaluation_id>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def evaluation_notes(evaluation_id: int):
|
||||||
|
"""
|
||||||
|
Liste des notes à partir de l'id d'une évaluation donnée
|
||||||
|
"""
|
||||||
|
evals = models.Evaluation.query.filter_by(id=evaluation_id)
|
||||||
|
notes = evals.get_notes()
|
||||||
|
|
||||||
|
data = [d.to_dict() for d in notes]
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<int:note>",
|
||||||
|
methods=["POST"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def evaluation_set_notes(eval_id: int, etudid: int, note: float):
|
||||||
|
"""
|
||||||
|
Set les notes d'une évaluation pour un étudiant donnée
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
############## Absences #############
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/absences/<int:etudid>", methods=["GET"])
|
||||||
|
@bp.route("/absences/<int:etudid>/abs_just_only", methods=["GET"])
|
||||||
|
def absences(etudid: int):
|
||||||
|
"""
|
||||||
|
Liste des absences d'un étudiant donnée
|
||||||
|
"""
|
||||||
|
abs = models.Absence.query.filter_by(id=etudid)
|
||||||
|
|
||||||
|
data = [d.to_dict() for d in abs]
|
||||||
|
|
||||||
|
# return jsonify(data)
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/absences/abs_signale", methods=["POST"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def abs_signale():
|
||||||
|
"""
|
||||||
|
Retourne un html
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/absences/abs_annule", methods=["POST"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def abs_annule():
|
||||||
|
"""
|
||||||
|
Retourne un html
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/absences/abs_annule_justif", methods=["POST"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def abs_annule_justif():
|
||||||
|
"""
|
||||||
|
Retourne un html
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/absences/abs_group_etat/?group_ids=<int:group_ids>&date_debut=date_debut&date_fin=date_fin",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@token_auth.login_required
|
||||||
|
def abs_groupe_etat(
|
||||||
|
group_ids: int, date_debut, date_fin, with_boursier=True, format="html"
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Liste des absences d'un ou plusieurs groupes entre deux dates
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
################ Logos ################
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/logos", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def liste_logos(format="json"):
|
||||||
|
"""
|
||||||
|
Liste des logos définis pour le site scodoc.
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/logos/<string:nom>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def recup_logo_global(nom: str):
|
||||||
|
"""
|
||||||
|
Retourne l'image au format png ou jpg
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/departements/<string:dept>/logos", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def logo_dept(dept: str):
|
||||||
|
"""
|
||||||
|
Liste des logos définis pour le département visé.
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/departement/<string:dept>/logos/<string:nom>", methods=["GET"])
|
||||||
|
@token_auth.login_required
|
||||||
|
def recup_logo_dept_global(dept: str, nom: str):
|
||||||
|
"""
|
||||||
|
L'image format png ou jpg
|
||||||
|
"""
|
||||||
|
return error_response(501, message="Not implemented")
|
||||||
|
Loading…
Reference in New Issue
Block a user