From b00ab090797b8dbad7346f2c906cafcaa5bcd825 Mon Sep 17 00:00:00 2001 From: Wal Date: Sun, 10 Dec 2023 13:15:49 +0100 Subject: [PATCH 1/4] Gestion Horaire osamerilyabcp --- Documents/proto/general/openapi.yaml | 689 ++++++++++++++++++++++++--- 1 file changed, 630 insertions(+), 59 deletions(-) diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 4c74faa..64fa70c 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -11,39 +11,108 @@ servers: paths: /ping: get: - summary: Test if the api is up. + summary: Check the API status responses: default: - description: Standard response to ping + description: pong content: text/plain: schema: type: string example: pong - /user: - put: - summary: create a new user + /users: + get: + summary: list all users tags: - - users + - SI security: - bearer: [] - responses: + parameters: + - in: query + name: type + required: false + schema: + type: string + enum: [teacher, student, secretary] + responses: '200': - description: User created + description: OK + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" '401': $ref: '#/components/responses/UnauthorizedError' - /user/{mat}: + + /user: get: - summary: get user's info + summary: get informations about yourself tags: - - users + - Users responses: '200': - description: User found + description: Ok content: application/json: schema: $ref: "#/components/schemas/User" + post: + summary: Create user + tags: + - Users + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + LastName: + type: string + FirstName: + type: string + Email: + type: string + Address: + $ref: "#/components/schemas/Address" + BirthDate: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + example: + { + "LastName": "Doe" , + "FirstName": "John", + "Email": "John.Doe@example.com", + "Address": { + "Address": "Rue de Tournais 42", + "Country": "BE"}, + "BirthDate": "1941-02-22", + } + responses: + '201': + description: User created + '401': + $ref: '#/components/responses/UnauthorizedError' + patch: + summary: Change informations about yourself + tags: + - Users + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/User' + responses: + '201': + description: Successfully changed. + '401': + $ref: '#/components/responses/UnauthorizedError' + /user/{mat}: parameters: - name: mat in: path @@ -51,42 +120,459 @@ paths: required: true schema: type: integer - - /cursus/{id}: get: - summary: Voir les informations sur un Cursus + summary: Get user's informations + tags: + - Admin + responses: + '200': + description: User found + content: + application/json: + schema: + $ref: "#/components/schemas/User" + patch: + summary: Alter user's informations + tags: + - Admin + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/User' + responses: + '201': + description: Successfully changed + '401': + $ref: '#/components/responses/UnauthorizedError' + /course: + post: + summary: Create new course + tags: + - Courses + - Secretariat + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + courses: + type: array + items: + type: string + responses: + '201': + description: course created + '401': + $ref: '#/components/responses/UnauthorizedError' + /courses/{id}: + get: + summary: see courses informations tags: - Courses responses: '200': - description: Cursus found + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Course' + parameters: + - name: id + in: path + required: true + schema: + type: integer + delete: + summary: delete a course + tags: + - Courses + - Secretariat + security: + - bearer: [] + responses: + '201': + description: Success + '401': + $ref: '#/components/responses/UnauthorizedError' + patch: + summary: Change course options + tags: + - Secretariat + - Courses + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + credits: + type: integer + faculty: + type: string + teachers: + type: object + $ref: '#/components/schemas/User' + assistants: + type: array + items: + $ref: '#/components/schemas/User' + example: + { + "name": "Math pour l'info", + "credits": 11, + "faculty": "science", + "Teacher": , + "Assistants": [ ] + } + responses: + '201': + description: Course modified + '401': + $ref: '#/components/responses/UnauthorizedError' + + /cursus: + post: + summary: Create a cursus + tags: + - cursus + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + courses: + type: array + items: + type: integer + description: id of courses + example: + { + "name": "Bac1", + [] + } + responses: + '201': + description: Cursus created + '401': + $ref: '#/components/responses/UnauthorizedError' + /cursus/{id}: + get: + summary: See Cursus's informations + tags: + - cursus + responses: + '200': + description: OK content: application/json: schema: $ref: '#/components/schemas/Cursus' - /courses/{id}: - get: - summary: Voir les informations sur un cours* - tags: - - Courses - responses: - - put: - summary: Créer un nouveau cours - tags: - - Courses - security: - - bearer: [] - responses: - + parameters: + - name: id + in: path + required: true + schema: + type: integer delete: - summary: Suprimer un cours + summary: Delete cursus tags: - - Courses + - cursus security: - bearer: [] responses: - + '201': + description: Success + '401': + $ref: '#/components/responses/UnauthorizedError' + patch: + summary: Modify cursus + tags: + - cursus + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + credits: + type: integer + faculty: + type: string + teachers: + type: object + $ref: '#/components/schemas/User' + assistants: + type: array + items: + $ref: '#/components/schemas/User' + example: + { + "name": "Math pour l'info", + "credits": 11, + "faculty": "science", + "Teacher": , + "Assistants": [ ] + } + responses: + '201': + description: Cursus modified + '401': + $ref: '#/components/responses/UnauthorizedError' + + /lesson: + post: + summary: Create a new lesson + tags: + - Secretariat + - lesson + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + date: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + IDcourse: + type: integer + duration: + type: number + classroom: + type: string + responses: + '201': + description: Lesson created + '401': + $ref: '#/components/responses/UnauthorizedError' + /lesson/{id}: + parameters: + - name: id + in: path + required: true + schema: + type: integer + get: + summary : See lesson's informations + tags: + - Users + - lesson + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Lesson' + patch: + summary : Modify Lesson + tags: + - Secretariat + - lesson + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + date: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + IDcourse: + type: integer + duration: + type: number + classroom: + type: string + responses: + '201': + description: Lesson modified + '401': + $ref: '#/components/responses/UnauthorizedError' + + delete: + summary: Delete lesson + tags: + - lesson + - Secretariat + security: + - bearer: [] + responses: + '201': + description: Success + '401': + $ref: '#/components/responses/UnauthorizedError' + /request: + post: + summary: Create a new request + tags: + - Teacher + - request + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: integer + requestType: + type: string + lessonId: + type: integer + responses: + '201': + description: Request created + /request/{id}: + parameters: + - name: id + in: path + required: true + schema: + type: integer + get: + summary : See request information + tags: + - Teacher + - Secretariat + - request + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Request' + patch: + summary : Modify request + tags: + - Teacher + - request + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: integer + requestType: + type: string + lessonId: + type: integer + responses: + '201': + description: Request modified + delete: + summary: Delete request + tags: + - Teacher + - Secretariat + - request + responses: + '201': + description: Success + + /display: + post: + summary: Create a new display + tags: + - display + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: integer + time: + type: string + display: + type: string + userId: + type: integer + responses: + '201': + description: display created + + /display/{id}: + parameters: + - name: id + in: path + required: true + schema: + type: integer + get: + summary : See display information + tags: + - Users + - display + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Display' + patch: + summary : Modify display + tags: + - Users + - display + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: integer + time: + type: string + display: + type: string + userId: + type: integer + responses: + '201': + description: Display modified components: securitySchemes: @@ -97,54 +583,82 @@ components: User: type: object properties: - RegNo: + regNo: type: integer - Photo: + photo: type: object - LastName: + lastName: type: string - FirstName: + firstName: type: string - Email: + email: type: string - Address: + address: $ref: "#/components/schemas/Address" - BirthDate: + birthDate: type: string description: Follow the iso 8601 ("YYYY-MM-DD") - StaffMember: - type: boolean example: { - "RegNo": 42, - "LastName": "Doe" , - "FirstName": "John", - "Email": "John.Doe@example.com", - "Address": { - "Address": "Rue de Tounais 42", - "Country": "BE"}, - "BirthDate": "1941-02-22", - "StaffMember": true + "regNo": 42, + "lastName": "Doe" , + "firstName": "John", + "email": "John.Doe@example.com", + "address": { + "address": "Rue de Tounais 42", + "country": "BE"}, + "birthDate": "1941-02-22", + "staffMember": true, } Address: type: object properties: - Address: + address: type: string - Country: + country: type: string description: Follow the ISO-3166-1 alpha-2 standard. example: { - "Address": "Rue de Tounais 42", - "Country": "BE" + "address": "Rue de Tounais 42", + "country": "BE" + } + Course: + type: object + properties: + id: + type: integer + name: + type: string + credits: + type: integer + faculty: + type: string + teachers: + type: integer + description: user's id + assistants: + type: array + items: + type: integer + description: user's id + example: + { + "id": 42, + "name": "Math pour l'info", + "credits": 11, + "faculty": "science", + "Teacher": 42, + "Assistants": [ ] } Cursus: type: object properties: - Id: + id: type: integer - Courses: + name: + type: string + courses: type: array items: type: string @@ -153,6 +667,63 @@ components: "id": 42, "courses": ['Math', 'Info'] } + Lesson : + type: object + properties: + id: + type: integer + date: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + duration: + type: number + description: duration of a course in hours + classroom: + type: string + course: + $ref: "#/components/schemas/Course" + example: + { + "id": 12, + "date": "2023-12-01", + "duration": 1.5, + "classroom": "AMPHI01", + "course": } + Request: + type: object + properties: + id: + type: integer + requestType: + type: string + lessonId: + type: integer + example: + { + "id": 12, + "requestType": "delete", + "lessonId": 72 + } + Display: + type: object + properties: + id: + type: integer + time: + type: string + description: Define the period displayed on the schedule (week,month,quadrimester..) + display: + type: string + userId: + type: integer + description: Id of the user who owns this display + example: + { + "id": 12, + "time": "month", + "display": "grid", + "UserId": 12 + } responses: UnauthorizedError: - description: Access token is missing or invalid + description: Unauthorized access or missing bearer \ No newline at end of file From 87d00943c0cf42c8058a53257807b3ca78ea1e77 Mon Sep 17 00:00:00 2001 From: Wawilski Date: Mon, 11 Dec 2023 11:31:34 +0100 Subject: [PATCH 2/4] Adding Ext (Schedule) --- Documents/proto/general/openapi.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 621e382..97f0cf8 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -378,6 +378,7 @@ paths: tags: - Secretariat - lesson + - Ext (Schedule) security: - bearer: [] requestBody: @@ -413,6 +414,7 @@ paths: tags: - Users - lesson + - Ext (Schedule) responses: '200': description: OK @@ -425,6 +427,7 @@ paths: tags: - Secretariat - lesson + - Ext (Schedule) security: - bearer: [] requestBody: @@ -454,6 +457,7 @@ paths: tags: - lesson - Secretariat + - Ext (Schedule) security: - bearer: [] responses: @@ -467,6 +471,7 @@ paths: tags: - Teacher - request + - Ext (Schedule) requestBody: required: true content: @@ -496,6 +501,7 @@ paths: - Teacher - Secretariat - request + - Ext (Schedule) responses: '200': description: OK @@ -508,6 +514,7 @@ paths: tags: - Teacher - request + - Ext (Schedule) requestBody: required: true content: @@ -530,6 +537,7 @@ paths: - Teacher - Secretariat - request + - Ext (Schedule) responses: '201': description: Success @@ -539,6 +547,7 @@ paths: summary: Create a new display tags: - display + - Ext (Schedule) requestBody: required: true content: @@ -570,6 +579,7 @@ paths: tags: - Users - display + - Ext (Schedule) responses: '200': description: OK @@ -582,6 +592,7 @@ paths: tags: - Users - display + - Ext (Schedule) requestBody: required: true content: From 93ec63beae19f8ecef00391531078821ffa16767 Mon Sep 17 00:00:00 2001 From: Wal Date: Mon, 11 Dec 2023 14:13:37 +0100 Subject: [PATCH 3/4] Modify Request --- Documents/proto/general/openapi.yaml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 97f0cf8..90f59a2 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -508,7 +508,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Request' + $ref: '#/components/schemas/ScheduleRequest' patch: summary : Modify request tags: @@ -727,7 +727,7 @@ components: "duration": 1.5, "classroom": "AMPHI01", "course": } - Request: + ScheduleRequest: type: object properties: id: @@ -736,12 +736,29 @@ components: type: string lessonId: type: integer + description: In the ADD case, lessonId is null + teacherId: + type: integer + newDate: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + newClassroom: + type: string + newCourse: + type: string + description: In the ADD case, correspond to the name of the course to add + example: { "id": 12, - "requestType": "delete", - "lessonId": 72 + "requestType": "moveLesson", + "lessonId": 52, + "teacherId": 12, + "newDate": "2023-12-20", + "newClassroom":, + "newCourse":, } + Display: type: object properties: From ffc8682453345559e7d4df64efa7f5f97ba946fa Mon Sep 17 00:00:00 2001 From: Wal Date: Tue, 12 Dec 2023 11:39:18 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Modification=20via=20les=20r=C3=A9visions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documents/proto/general/openapi.yaml | 105 ++++++++++++--------------- 1 file changed, 48 insertions(+), 57 deletions(-) diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 90f59a2..187f3d3 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -57,13 +57,6 @@ paths: - Users security: - bearer: [] - parameters: - - in: query - name: type - required: false - schema: - type: string - enum: [teacher, student, secretary] responses: '200': description: Ok @@ -248,7 +241,6 @@ paths: faculty: type: string teachers: - type: object $ref: '#/components/schemas/User' assistants: type: array @@ -352,7 +344,6 @@ paths: faculty: type: string teachers: - type: object $ref: '#/components/schemas/User' assistants: type: array @@ -377,7 +368,7 @@ paths: summary: Create a new lesson tags: - Secretariat - - lesson + - Lesson - Ext (Schedule) security: - bearer: [] @@ -391,7 +382,7 @@ paths: date: type: string description: Follow the iso 8601 ("YYYY-MM-DD") - IDcourse: + CourseId: type: integer duration: type: number @@ -413,7 +404,7 @@ paths: summary : See lesson's informations tags: - Users - - lesson + - Lesson - Ext (Schedule) responses: '200': @@ -426,7 +417,7 @@ paths: summary : Modify Lesson tags: - Secretariat - - lesson + - Lesson - Ext (Schedule) security: - bearer: [] @@ -455,7 +446,7 @@ paths: delete: summary: Delete lesson tags: - - lesson + - Lesson - Secretariat - Ext (Schedule) security: @@ -465,12 +456,12 @@ paths: description: Success '401': $ref: '#/components/responses/UnauthorizedError' - /request: + /scheduleRequest: post: summary: Create a new request tags: - Teacher - - request + - ScheduleRequest - Ext (Schedule) requestBody: required: true @@ -479,16 +470,24 @@ paths: schema: type: object properties: - id: - type: integer requestType: type: string lessonId: type: integer + newDate: + type: string + description: Follow the iso 8601 ("YYYY-MM-DD") + newClassroom: + type: string + newCourseId: + type: integer responses: '201': description: Request created - /request/{id}: + '401': + $ref: '#/components/responses/UnauthorizedError' + + /scheduleRequest/{id}: parameters: - name: id in: path @@ -500,7 +499,7 @@ paths: tags: - Teacher - Secretariat - - request + - ScheduleRequest - Ext (Schedule) responses: '200': @@ -513,7 +512,7 @@ paths: summary : Modify request tags: - Teacher - - request + - ScheduleRequest - Ext (Schedule) requestBody: required: true @@ -522,11 +521,11 @@ paths: schema: type: object properties: - id: - type: integer - requestType: + newDate: type: string - lessonId: + newClassroom: + type: string + newCourseId: type: integer responses: '201': @@ -536,7 +535,7 @@ paths: tags: - Teacher - Secretariat - - request + - ScheduleRequest - Ext (Schedule) responses: '201': @@ -546,7 +545,7 @@ paths: post: summary: Create a new display tags: - - display + - Display - Ext (Schedule) requestBody: required: true @@ -555,11 +554,9 @@ paths: schema: type: object properties: - id: - type: integer - time: + timeMode: type: string - display: + displayMode: type: string userId: type: integer @@ -578,7 +575,7 @@ paths: summary : See display information tags: - Users - - display + - Display - Ext (Schedule) responses: '200': @@ -591,7 +588,7 @@ paths: summary : Modify display tags: - Users - - display + - Display - Ext (Schedule) requestBody: required: true @@ -600,14 +597,10 @@ paths: schema: type: object properties: - id: - type: integer - time: + timeMode: type: string - display: + displayMode: type: string - userId: - type: integer responses: '201': description: Display modified @@ -718,15 +711,16 @@ components: description: duration of a course in hours classroom: type: string - course: - $ref: "#/components/schemas/Course" + courseId: + type: integer example: - { - "id": 12, - "date": "2023-12-01", - "duration": 1.5, - "classroom": "AMPHI01", - "course": } + { + "id": 12, + "date": "2023-12-01", + "duration": 1.5, + "classroom": "AMPHI01", + "courseId": 12 + } ScheduleRequest: type: object properties: @@ -736,7 +730,6 @@ components: type: string lessonId: type: integer - description: In the ADD case, lessonId is null teacherId: type: integer newDate: @@ -744,10 +737,8 @@ components: description: Follow the iso 8601 ("YYYY-MM-DD") newClassroom: type: string - newCourse: - type: string - description: In the ADD case, correspond to the name of the course to add - + newCourseId: + type: integer example: { "id": 12, @@ -756,7 +747,7 @@ components: "teacherId": 12, "newDate": "2023-12-20", "newClassroom":, - "newCourse":, + "newCourseId":, } Display: @@ -764,10 +755,10 @@ components: properties: id: type: integer - time: + timeMode: type: string description: Define the period displayed on the schedule (week,month,quadrimester..) - display: + displayMode: type: string userId: type: integer @@ -775,8 +766,8 @@ components: example: { "id": 12, - "time": "month", - "display": "grid", + "timeMode": "month", + "displayMode": "grid", "UserId": 12 } responses: