diff --git a/API_Interfaces.txt b/API_Interfaces.txt index b1c2634..b5a9ad7 100644 --- a/API_Interfaces.txt +++ b/API_Interfaces.txt @@ -23,6 +23,7 @@ GET -> Get the current logged user, return None if no one is connected Out: 200 -> USER = |null : Dictionary containing user infos or null + ######################## UserAPI (api/user) ######################## @@ -52,6 +53,7 @@ GET -> Getting specified user infos Out: 200 -> USER = |null : Dictionary containing user infos or null + ######################## GroupAPI (api/group) ######################## @@ -103,6 +105,7 @@ OPTIONS -> Add pairs of users (student/tutor) to the group 405 -> ERROR = "This group doesn't exists !" : Bad GROUP_ID provided 409 -> ERROR = "Pairs are incorrectly formed !" : Bad syntax in pairs table + ######################## LivretAPI (api/livret) ######################## @@ -146,4 +149,47 @@ PUT -> Modify an existing livret GET -> Getting specified livret infos In: (Suffixes = /bylid/ | /bytutorship// ) Out: - 200 -> LIVRET = |null : Dictionary containing livret infos or null \ No newline at end of file + 200 -> LIVRET = |null : Dictionary containing livret infos or null + + +######################## +PeriodAPI (api/period) +######################## +POST -> Create a period for all livrets in a group + In: + group_id = Id of the group where this period should be inserted in + period_type = Type of the period (1 = universitaire, 2 = entreprise) + start = Date of the period's beginning (format : dd-mm-yyyy) + end = Date of the period's end (format : dd-mm-yyyy) + Out: + 200 -> RESULT = OK : The period has been successfully created in all the livrets in the given group + 400 -> ERROR = "One or more parameters are missing" : Bad request + 401 -> ERROR = "UNAUTHORIZED" : The current user is not allowed to modify this group (only the group's resp can do it) + 400 -> ERROR = "The period's start can't be after its end !" : The given period's end date is anterior to it's beginning + 405 -> ERROR = "The group with id GROUP_ID doesn't exists !" : The given GROUP_ID is not found + +PUT -> Add the comments of a user in an existing period + In: (Suffix = /bypid/) + text = Comment added by the user about the period (student or etutor) + Out: + 200 -> PID = : The period has been modified successfully with the id PERIOD_ID + 400 -> ERROR = "One or more parameters are missing !" : Bad request + 400 -> ERROR = "This period doesn't exists !" : Bad PERIOD_ID provided + 401 -> ERROR = "UNAUTHORIZED" : The current user is not allowed to modify this group (only the student and his etutor can do it) + 405 -> ERROR = "A tutor can't modify a university period !" : A tutor can't modify a university period :) + +GET -> Getting specified period infos + In: (Suffix = /bypid/) + Out: + 200 -> PERIOD = |null : Dictionary containing period infos or null + + +######################## +GetAllAPI (api/getAll) +######################## +GET -> Getting specified period infos + In: (Suffix = //) + Parameters for / : + periodsOfLivret/ : Returns all the periods associated to the given + Out: + 200 -> RESULT = \ No newline at end of file diff --git a/backend/app/api/PeriodAPI.py b/backend/app/api/PeriodAPI.py index 1cd752d..975597f 100644 --- a/backend/app/api/PeriodAPI.py +++ b/backend/app/api/PeriodAPI.py @@ -94,7 +94,7 @@ class PeriodAPI(Resource): query = PERIOD.update().values(student_desc=text).where(PERIOD.c.id == pid) else: # Sinon on vérifie que c'est une période d'entreprise if period["type"] == TypesPeriode.universitaire: - return {"ERROR": "A tutor can't modify a university period !"} + return {"ERROR": "A tutor can't modify a university period !"}, 405 mail = mailsModels.getMailContent("ETUTOR_COMMENT_ADDED", {"TUTEUR": user["name"], "URL": getParam('OLA_URL')})