From d0b615c59def53a42fb4c80edbcbf8479e16e694 Mon Sep 17 00:00:00 2001 From: MAILLAL Anas Date: Fri, 21 Mar 2025 09:42:57 +0100 Subject: [PATCH] fix: the endpoints reflect the db models and changes since the last version of the doc, notes.md indicate some changes that are needed to happen in the controller and questions to be discussed --- .gitignore | 2 + .../openapi/main.yaml | 180 ++++++++---------- documentation/openapi/notes.md | 47 +++++ .../openapi/swagger-ui/main.js | 0 .../openapi/swagger-ui/package-lock.json | 0 .../openapi/swagger-ui/package.json | 0 6 files changed, 126 insertions(+), 103 deletions(-) rename {Documentation => documentation}/openapi/main.yaml (85%) create mode 100644 documentation/openapi/notes.md rename {Documentation => documentation}/openapi/swagger-ui/main.js (100%) rename {Documentation => documentation}/openapi/swagger-ui/package-lock.json (100%) rename {Documentation => documentation}/openapi/swagger-ui/package.json (100%) diff --git a/.gitignore b/.gitignore index 170ba0d..9a2dba3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .idea keycloak/CAS/target docker-compose.yaml +node_modules +.vscode \ No newline at end of file diff --git a/Documentation/openapi/main.yaml b/documentation/openapi/main.yaml similarity index 85% rename from Documentation/openapi/main.yaml rename to documentation/openapi/main.yaml index 67f878c..f567a74 100644 --- a/Documentation/openapi/main.yaml +++ b/documentation/openapi/main.yaml @@ -18,49 +18,55 @@ components: user: type: object properties: - nom: + idUser: + type: integer + userSurname: type: string - prenom: + userName: type: string - email: + primaryMail: type: string example: "example@exmaple.com" - secondaryEmail: + secondaryMail: type: string example: "example@exmaple.com" - tel: + phoneNumber: type: string example: "0612345678" + user-entrepreneur: - type: object - properties: - user: - $ref: "#/components/schemas/user" - entrepreneur: - type: object - properties: - ecole: + allOf: + - $ref: "#/components/schemas/user" + - type: object + properties: + school: type: string example: "enseirb" - filiere: + course: type: string example: "info" - status: + sneeStatus: type: boolean example: false + user-admin: + allOf: + - $ref: "#/components/schemas/user" + + sectionCell: type: object properties: - admin: - $ref: "#/components/schemas/user" - lcsection: - type: object - properties: - title: + idSectionCell: + type: integer + example: this the cell (postit id) + sectionId: + type: integer + contentSectionCell: type: string - txt: + modificationDate: type: string - projects: + + project: type: object properties: idProject: @@ -69,6 +75,33 @@ components: type: string creationDate: type: string + logo: + example: to be discussed not yet fixed + type: string + format: binary + + report: + type: object + properties: + idReport: + type: integer + reportContent: + type: string + + appointement: + type: object + properties: + appointmentDate: + type: string + appointmentTime: + type: string + appointmentDuration: + type: string + appointmentPlace: + type: string + appointmentSubject: + type: string + @@ -111,13 +144,7 @@ paths: schema: type: array items: - type: object - properties: - name: - type: string - E_names: - type: string - description: entrepreneur names + $ref: "#/components/schemas/project" "400": description: Bad request "401": @@ -174,12 +201,7 @@ paths: content: application/json: schema: - type: object - properties: - name: - type: string - founder: - $ref: "#/components/schemas/user-entrepreneur" + $ref: "#/components/schemas/project" responses: "200": @@ -213,14 +235,7 @@ paths: content: application/json: schema: - type: object - properties: - title: - type: string - body: - type: string - conclusion: - type: string + $ref: "#/components/schemas/report" responses: "200": @@ -251,14 +266,7 @@ paths: content: application/json: schema: - type: object - properties: - title: - type: string - body: - type: string - conclusion: - type: string + $ref: "#/components/schemas/report" responses: "200": @@ -308,8 +316,8 @@ paths: - MyINPulse-admin description: JSON array of who's elements are objects containing - necessary information for the view (project name, - entrepreneur names, etc..) of all pending projects. + necessary information for the view (project name, etc..) + of all pending projects. responses: "200": description: OK @@ -318,12 +326,7 @@ paths: schema: type: array items: - type: object - properties: - name: - type: string - founder: - $ref: "#/components/schemas/user-entrepreneur" + $ref: "#/components/schemas/project" "400": description: Bad request "401": @@ -356,20 +359,13 @@ paths: schema: type: array items: - type: object - properties: - name: - type: string - date: - type: string - time: - type: string + $ref: "#/components/schemas/appointement" "400": description: Bad request "401": description: Authorization information is missing or invalid - /shared/projects/lcsection/{projectId}/{title}/{date}: + /shared/projects/sectionCell/{projectId}/{sectionId}/{date}: get: summary: Retourne la liste de sections de LC avec un titre donné tags: @@ -391,12 +387,11 @@ paths: type: integer - in: path required: true - description: this number can be 1, 2,...,8. It is associated with the title of the lcsection - name: title + description: this number can be 1, 2,...,8. It is associated with the title of the sectionCell + name: sectionId schema: type: integer - enum: [1, 2, 3, 4, 5, 6, 7, 8] - + enum: [1, 2, 3, 4, 5, 6, 7, 8] - in: path required: true name: date @@ -413,7 +408,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/lcsection" + $ref: "#/components/schemas/sectionCell" "400": description: Bad request "401": @@ -508,22 +503,13 @@ paths: schema: type: array items: - type: object - properties: - appointementId: - type: integer - name: - type: string - date: - type: string - time: - type: string + $ref: "#/components/schemas/appointement" "400": description: Bad request "401": description: Authorization information is missing or invalid - /shared/projects/appointments/report/{apointementId}: + /shared/projects/appointments/report/{appointmentId}: get: summary: Retourne le rapport pdf du rendez-vous tags: @@ -648,7 +634,7 @@ paths: missing or invalid - /entrepreneur/lcsection/add/{projectId}: + /entrepreneur/sectionCell/add: post: summary: ajouter une sections au LC description: @@ -659,18 +645,12 @@ paths: security: - MyINPulse: - MyINPulse-entrepreneur - parameters: - - in: path - name: projectId - schema: - type: integer - required: true requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/lcsection" + $ref: "#/components/schemas/sectionCell" responses: "200": description: OK @@ -679,7 +659,7 @@ paths: "401": description: Authorization information is missing or invalid - /entrepreneur/lcsection/modify/{sectionId}: + /entrepreneur/sectionCell/modify: put: summary: modifier les données d'une section LC description: @@ -691,18 +671,12 @@ paths: security: - MyINPulse: - MyINPulse-entrepreneur - parameters: - - in: path - name: sectionId - schema: - type: integer - required: true requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/lcsection" + $ref: "#/components/schemas/sectionCell" responses: "200": description: OK @@ -712,7 +686,7 @@ paths: description: Authorization information is missing or invalid - /entrepreneur/lcsection/remove/{sectionId}: + /entrepreneur/sectionCell/remove/{sectionCellId}: delete: summary: supprimer une section LC. description: @@ -724,7 +698,7 @@ paths: - MyINPulse-entrepreneur parameters: - in: path - name: sectionId + name: sectionCellId schema: type: integer required: true diff --git a/documentation/openapi/notes.md b/documentation/openapi/notes.md new file mode 100644 index 0000000..b82fa22 --- /dev/null +++ b/documentation/openapi/notes.md @@ -0,0 +1,47 @@ +## API Endpoints notes + +### EntrepreneurApi and SharedApi +#### Endpoint Name Changes +- `/entrepreneur/lcsection/modify/{sectionId}` → `/entrepreneur/sectionCell/modify/{sectionId}` + +### Admin api +- `/admin/appointments/upcoming`: is shared not admin +- `/admin/projects/decision`: instanciates classes with `adminId` instead of taking the id from the token +- `/admin/project/add`: + - point 1: the doc has this `projects` everywhere this should be `/admin/projects/add` to avoid confusion I think + - point 2: this doesn't assiociate users with a project I need to add other endopint for that +- `/admin/appoitements/report/{appointmentId}`: + - typo: `appoitements` → `appointments` +- `/admin/projects/remove/{projectId}`, `/admin/project/add`, `/admin/projects/decision`, `/admin/projects/pending`: + - should need token to delete or add project + +### Entrepreneur api +- `/entrepreneur/sectionCell/modify/{sectionId}`: + - the section-id because of the definition of `sectionCell` schema the `sectionId` is given twice possibly leading to inconsistency. Which is why the path var to be removed: + - → `/entrepreneur/sectionCell/modify` + +### Shared api +- `/shared/project/sectionCell/{projectId}/{sectionId}/{date}`: + - point 1: + same point for `project` → `projects` + - point 2: + have yet to read `sharedApiService` to see how dates are handled and to see if we agree on values of `date` to make it so it gets the version relative to current date +- `/shared/entrepreneurs/{projectId}`: + - maybe change to `/shared/projects/entrepreneurs/{projectId}` to match other similair endpoints like `/shared/projects/admin/{projectId}` +- `/shared/appointment/request`: + - creates the apointement but don't know how it associates other users, potentially multiple classes in one request body, is that possible ? + +## TODOs for me + +### list 1: +- add back-end server links (backend and auth) for interacting with api through swagger +- get config for that set up in the project + +### list 2: +- see what to do about logo img +- see format for date and add it in examples +- ask the form of return of the json of iterables, for now I have put array +- add endpoint for adding users to a project +- update endpoint descriptions +- add examples for values in schemas + diff --git a/Documentation/openapi/swagger-ui/main.js b/documentation/openapi/swagger-ui/main.js similarity index 100% rename from Documentation/openapi/swagger-ui/main.js rename to documentation/openapi/swagger-ui/main.js diff --git a/Documentation/openapi/swagger-ui/package-lock.json b/documentation/openapi/swagger-ui/package-lock.json similarity index 100% rename from Documentation/openapi/swagger-ui/package-lock.json rename to documentation/openapi/swagger-ui/package-lock.json diff --git a/Documentation/openapi/swagger-ui/package.json b/documentation/openapi/swagger-ui/package.json similarity index 100% rename from Documentation/openapi/swagger-ui/package.json rename to documentation/openapi/swagger-ui/package.json