From ef8c8e896d66efcd88efb53925224f6f9cc01a48 Mon Sep 17 00:00:00 2001 From: MAILLAL Anas Date: Wed, 12 Feb 2025 20:59:13 +0100 Subject: [PATCH 1/4] feat: added openapi documentation to the project --- Documentation/BackendApi/openapi.yaml | 701 ++++++++++++++++++++++++++ 1 file changed, 701 insertions(+) create mode 100644 Documentation/BackendApi/openapi.yaml diff --git a/Documentation/BackendApi/openapi.yaml b/Documentation/BackendApi/openapi.yaml new file mode 100644 index 0000000..a116633 --- /dev/null +++ b/Documentation/BackendApi/openapi.yaml @@ -0,0 +1,701 @@ +openapi: 3.0.3 +info: + title: MyInpulse Backend Api + description: this document servers as a documentation for the backend api. + version: 0.0.0 + +tags: + - name: Entrepreneurs API + description: La partie de l'api dédiée aux entrepreneurs + - name: Admin API + description: La partie de l'api dédiée aux entrepreneurs + - name: Shared API + description: La partie de l'api dédiée aux entrepreneurs et admins + + +components: + schemas: + founder: + type: object + properties: + user: + type: object + properties: + nom: + type: string + prenom: + type: string + email: + type: string + scondaryEmail: + type: string + tel: + type: string + entrepreneur: + type: object + properties: + ecole: + type: string + filiere: + type: string + status: + type: string + + securitySchemes: + MyINPulse: + type: oauth2 + flows: + implicit: + authorizationUrl: https://petstore3.swagger.io/oauth/authorize + scopes: + MyINPulse-admin: Administrateur + MyINPulse-entrepreneur: Utilisateur + +paths: + /admin/projects: + get: + summary: Retourne la liste of projets associés à l'admin + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of who’s elements are objects containing necessary information for the view + (project name, entrepreneur names, etc..) + of the projects an admin is watching over. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + E_names: + type: string + description: entrepreneur names + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /admin/appointments/upcoming: + get: + summary: Retourne la list des prochains rendez-vous de l'admin + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + description: + JSON array of upcoming appointment data (name, date, time etc..) for an admin. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + /admin/projects/pending: + get: + summary: Retourne la liste des projets en attente de validation + tags: + - Admin API + security: + - MyINPulse: + - 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. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/founder" + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /projects/lcsection/{projectId}/{title}/{date}: + get: + summary: Retourne la liste de sections de LC avec un titre donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array containing Lean Canvas + section data with a title for the + current date (or given date if the + date parameter is passed) + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + - in: path + name: title + schema: + type: string + required: true + description: the name of lc section + - in: path + name: date + required: true + schema: + type: string + description: the date corresponding to the wanted version of lc section + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + section: + type: string + txt: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /projects/entrepreneurs/{projectId}: + get: + summary: Retourne la liste d'entrepreneurs associée à un projet donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of entrepreneur + names associated with a project + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + /projects/contacts/entrepreneurs/{projectId}: + get: + summary: Retourne la liste des contactes d'entrepreneurs associée à un projet donné + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of contacts for + each participant in the project with id + projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + email: + type: string + tel: + type: string + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /projects/contacts/admin/{projectId}: + get: + summary: Retourne les contacts de l'admin que accompagne le projet + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON object containing contact information (name, gmail, tel, etc..) + the admin supervising the project with id + projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + name: + type: string + email: + type: string + tel: + type: string + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /projects/appointments/{projectId}: + get: + summary: Retourne les rendez-vous du project + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming and past appointment + data for the project with id projectID. + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + appointementId: + type: integer + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /projects/appointments/report/{apointementId}: + get: + summary: Retourne le rapport pdf du rendez-vous + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + PDF file containing the ap- + pointment report + parameters: + - in: path + name: apointementId + schema: + type: integer + required: true + responses: + "200": + description: OK + content: + application/pdf: + schema: + type: string + format: binary + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /projects/request: + post: + summary: demander la création et validation d'un projet + tags: + - Entrepreneurs API + description: + Adds project to pending projects + to then be accepted or rejected by + an admin + security: + - MyINPulse: + - MyINPulse-entrepreneur + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/founder" + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/pending/decision: + post: + summary: valider un projet en attente de validation + tags: + - Admin API + description: + if the request is accepted the status of the + project is changed to ongoing, entrepreneur + account is confirmed and the project is linked + to the admin accepting the request and the + entrepreneur requesting it. Else the pending + project and user info are deleted. + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + pedingProjectId: + type: integer + decision: + type: boolean + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/add: + post: + summary: Ajout mannuel d'un projet + description: + Adds a project with the + inputed details + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founderName: + type: string + founderEmail: + type: string + school: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/remove/{projectId}: + delete: + summary: supression d'un project + description: + Removes the project + with the inputed id projectId + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: projectId + required: true + schema: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /lcsection/add/{projectId}: + post: + summary: ajouter une sections au LC + description: + Adds input data to the user’s LC + with a specified title. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: projectId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + /lcsection/modify/{sectionId}: + put: + summary: modifier les données d'une section LC + description: + Modifies input Lean Canvas section by changing it to + the information in the request body and changes the + time stamp. + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + txt: + type: string + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /lcsection/remove/{sectionId}: + delete: + summary: supprimer une section LC. + description: + Deletes section from Lean Canvas + tags: + - Entrepreneurs API + security: + - MyINPulse: + - MyINPulse-entrepreneur + parameters: + - in: path + name: sectionId + schema: + type: integer + required: true + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /appointments/request: + post: + summary: demander une rendez-vous + description: + will add an appointement request request by the applicant + to have an appointment to be confirmed or denied by the + specified participants of the appointement. + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-entrepreneur + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + start_time: + type: string + end_time: + type: string + place: + type: string + applicantId: + type: integer + participants: + type: array + items: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/appointments/report/{appointmentId}: + post: + summary: enregistrer une rapport du rendez-vous + description: + Generate a PDF file formatted + from input text and links it + to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + \ No newline at end of file From 79e949bdd4cba421037cef55c2a5330046ceebf2 Mon Sep 17 00:00:00 2001 From: MAILLAL Anas Date: Wed, 19 Feb 2025 01:36:52 +0100 Subject: [PATCH 2/4] feat: configured gradle file to generate code for api interface from swagger specification --- MyINPulse-back/build.gradle | 32 +++++ .../src/main/resources/openapi/main.yaml | 133 ++++++------------ 2 files changed, 75 insertions(+), 90 deletions(-) rename Documentation/BackendApi/openapi.yaml => MyINPulse-back/src/main/resources/openapi/main.yaml (85%) diff --git a/MyINPulse-back/build.gradle b/MyINPulse-back/build.gradle index abdd6a9..1f37fd3 100644 --- a/MyINPulse-back/build.gradle +++ b/MyINPulse-back/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.4.2' id 'io.spring.dependency-management' version '1.1.7' + id 'org.openapi.generator' version '7.11.0' } group = 'enseirb' @@ -20,8 +21,39 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-web' + // swagger Codegen + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0' + implementation 'jakarta.validation:jakarta.validation-api:3.0.2' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + +} + +sourceSets { + main { + java { + srcDir "$buildDir/generated/src/main/java" + } + } +} +sourceSets { + main { + java.srcDir("$buildDir/generated/src/main/java") + } +} + +openApiGenerate { + generatorName.set("spring") + inputSpec.set("$rootDir/src/main/resources/openapi.yaml") + outputDir.set("$buildDir/generated") + apiPackage.set("enseirb.myinpulse.api") + modelPackage.set("enseirb.myinpulse.model") + configOptions.put("dateLibrary", "java8") + configOptions.put("useSpringBoot3", "true") + //configOptions.put("interfaceOnly", "true") + configOptions.put("library", "spring-boot") } tasks.named('test') { diff --git a/Documentation/BackendApi/openapi.yaml b/MyINPulse-back/src/main/resources/openapi/main.yaml similarity index 85% rename from Documentation/BackendApi/openapi.yaml rename to MyINPulse-back/src/main/resources/openapi/main.yaml index a116633..fd8d645 100644 --- a/Documentation/BackendApi/openapi.yaml +++ b/MyINPulse-back/src/main/resources/openapi/main.yaml @@ -15,22 +15,24 @@ tags: components: schemas: - founder: + user: + type: object + properties: + nom: + type: string + prenom: + type: string + email: + type: string + scondaryEmail: + type: string + tel: + type: string + user-entrepreneur: type: object properties: user: - type: object - properties: - nom: - type: string - prenom: - type: string - email: - type: string - scondaryEmail: - type: string - tel: - type: string + $ref: "#/components/schemas/user" entrepreneur: type: object properties: @@ -40,6 +42,11 @@ components: type: string status: type: string + user-admin: + type: object + properties: + admin: + $ref: "#/components/schemas/user" securitySchemes: MyINPulse: @@ -139,13 +146,13 @@ paths: name: type: string founder: - $ref: "#/components/schemas/founder" + $ref: "#/components/schemas/user-entrepreneur" "400": description: Bad request "401": description: Authorization information is missing or invalid - /projects/lcsection/{projectId}/{title}/{date}: + /shared/projects/lcsection/{projectId}/{title}/{date}: get: summary: Retourne la liste de sections de LC avec un titre donné tags: @@ -173,7 +180,7 @@ paths: description: the name of lc section - in: path name: date - required: true + required: false schema: type: string description: the date corresponding to the wanted version of lc section @@ -198,7 +205,7 @@ paths: "401": description: Authorization information is missing or invalid - /projects/entrepreneurs/{projectId}: + /shared/projects/entrepreneurs/{projectId}: get: summary: Retourne la liste d'entrepreneurs associée à un projet donné tags: @@ -224,14 +231,15 @@ paths: schema: type: array items: - type: string + $ref: "#/components/schemas/user-entrepreneur" "400": description: Bad request "401": description: Authorization information is missing or invalid - /projects/contacts/entrepreneurs/{projectId}: + + /shared/projects/admin/{projectId}: get: - summary: Retourne la liste des contactes d'entrepreneurs associée à un projet donné + summary: Retourne les inforùations de l'admin qui accompagne le projet tags: - Shared API security: @@ -239,9 +247,8 @@ paths: - MyINPulse-admin - MyINPulse-entrepreneur description: - JSON array of contacts for - each participant in the project with id - projectID. + JSON object containing information (name, gmail, tel, etc..) + the admin supervising the project with id projectID. parameters: - in: path name: projectId @@ -254,64 +261,16 @@ paths: content: application/json: schema: - type: array - items: - type: object - properties: - name: - type: string - email: - type: string - tel: - type: string + $ref: "#/components/schemas/user-admin" "400": description: Bad request "401": description: Authorization information is missing or invalid - /projects/contacts/admin/{projectId}: + /shared/projects/appointments/{projectId}: get: - summary: Retourne les contacts de l'admin que accompagne le projet - tags: - - Shared API - security: - - MyINPulse: - - MyINPulse-admin - - MyINPulse-entrepreneur - description: - JSON object containing contact information (name, gmail, tel, etc..) - the admin supervising the project with id - projectID. - parameters: - - in: path - name: projectId - schema: - type: integer - required: true - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - name: - type: string - email: - type: string - tel: - type: string - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid - - /projects/appointments/{projectId}: - get: - summary: Retourne les rendez-vous du project + summary: Retourne les rendez-vous du projet tags: - Shared API security: @@ -350,7 +309,7 @@ paths: "401": description: Authorization information is missing or invalid - /projects/appointments/report/{apointementId}: + /shared/projects/appointments/report/{apointementId}: get: summary: Retourne le rapport pdf du rendez-vous tags: @@ -382,7 +341,7 @@ paths: description: Authorization information is missing or invalid - /projects/request: + /entrepreneur/projects/request: post: summary: demander la création et validation d'un projet tags: @@ -404,7 +363,7 @@ paths: name: type: string founder: - $ref: "#/components/schemas/founder" + $ref: "#/components/schemas/user-entrepreneur" responses: "200": description: OK @@ -470,12 +429,8 @@ paths: properties: name: type: string - founderName: - type: string - founderEmail: - type: string - school: - type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" responses: "200": @@ -513,7 +468,7 @@ paths: description: Authorization information is missing or invalid - /lcsection/add/{projectId}: + /entrepreneur/lcsection/add/{projectId}: post: summary: ajouter une sections au LC description: @@ -549,7 +504,7 @@ paths: "401": description: Authorization information is missing or invalid - /lcsection/modify/{sectionId}: + /entrepreneur/lcsection/modify/{sectionId}: put: summary: modifier les données d'une section LC description: @@ -587,7 +542,7 @@ paths: description: Authorization information is missing or invalid - /lcsection/remove/{sectionId}: + /entrepreneur/lcsection/remove/{sectionId}: delete: summary: supprimer une section LC. description: @@ -612,7 +567,7 @@ paths: description: Authorization information is missing or invalid - /appointments/request: + /shared/appointments/request: post: summary: demander une rendez-vous description: @@ -696,6 +651,4 @@ paths: "401": description: Authorization information is missing or invalid - - - \ No newline at end of file + \ No newline at end of file From b355463dd911fe4fe4a26eb3b5749363f31a22c5 Mon Sep 17 00:00:00 2001 From: MAILLAL Anas Date: Tue, 25 Feb 2025 22:34:33 +0100 Subject: [PATCH 3/4] docs: added needed modications and reorganized yaml file --- .../openapi/main.yaml | 514 ++++++++++-------- 1 file changed, 295 insertions(+), 219 deletions(-) rename {MyINPulse-back/src/main/resources => Documentation}/openapi/main.yaml (83%) diff --git a/MyINPulse-back/src/main/resources/openapi/main.yaml b/Documentation/openapi/main.yaml similarity index 83% rename from MyINPulse-back/src/main/resources/openapi/main.yaml rename to Documentation/openapi/main.yaml index fd8d645..00dc3d4 100644 --- a/MyINPulse-back/src/main/resources/openapi/main.yaml +++ b/Documentation/openapi/main.yaml @@ -59,6 +59,14 @@ components: MyINPulse-entrepreneur: Utilisateur paths: + +# _ ____ __ __ ___ _ _ _ ____ ___ +# / \ | _ \| \/ |_ _| \ | | / \ | _ \_ _| +# / _ \ | | | | |\/| || || \| | / _ \ | |_) | | +# / ___ \| |_| | | | || || |\ | / ___ \| __/| | +# /_/ \_\____/|_| |_|___|_| \_| /_/ \_\_| |___| +# + /admin/projects: get: summary: Retourne la liste of projets associés à l'admin @@ -90,37 +98,182 @@ paths: description: Bad request "401": description: Authorization information is missing or invalid - - /admin/appointments/upcoming: - get: - summary: Retourne la list des prochains rendez-vous de l'admin - tags: + /admin/projects/pending/decision: + post: + summary: valider un projet en attente de validation + tags: - Admin API - security: - - MyINPulse: - - MyINPulse-admin description: - JSON array of upcoming appointment data (name, date, time etc..) for an admin. + if the request is accepted the status of the + project is changed to ongoing, entrepreneur + account is confirmed and the project is linked + to the admin accepting the request and the + entrepreneur requesting it. Else the pending + project and user info are deleted. + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + pedingProjectId: + type: integer + decision: + type: boolean + responses: - "200": + "200": description: OK - content: - application/json: - schema: - type: array - items: - type: object - properties: - name: - type: string - date: - type: string - time: - type: string "400": description: Bad request "401": - description: Authorization information is missing or invalid + description: Authorization information is + missing or invalid + + /admin/projects/add: + post: + summary: Ajout manuel d'un projet + description: + Adds a project with the + inputed details + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + founder: + $ref: "#/components/schemas/user-entrepreneur" + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/appointments/report/{appointmentId}: + put: + summary: enregistrer un rapport du rendez-vous + description: + Generate a PDF file formatted + from input text and links it + to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + post: + summary: modifier un rapport déja éxistant du rendez-vous + description: + Modifies the report file to input + text and links it to the appointement. + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: appointmentId + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + body: + type: string + conclusion: + type: string + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + /admin/projects/remove/{projectId}: + delete: + summary: supression d'un project + description: + Removes the project + with the inputed id projectId + tags: + - Admin API + security: + - MyINPulse: + - MyINPulse-admin + parameters: + - in: path + name: projectId + required: true + schema: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + /admin/projects/pending: get: summary: Retourne la liste des projets en attente de validation @@ -151,8 +304,48 @@ paths: description: Bad request "401": description: Authorization information is missing or invalid - - /shared/projects/lcsection/{projectId}/{title}/{date}: + +# +# ____ _ _ _ ____ ___ +# / ___|| |__ __ _ _ __ ___ __| | / \ | _ \_ _| +# \___ \| '_ \ / _` | '__/ _ \/ _` | / _ \ | |_) | | +# ___) | | | | (_| | | | __/ (_| | / ___ \| __/| | +# |____/|_| |_|\__,_|_| \___|\__,_| /_/ \_\_| |___| +# + + /shared/appointments/upcoming: + get: + summary: Retourne la list des prochains rendez-vous de l'utilisateur + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-admin + - MyINPulse-entrepreneur + description: + JSON array of upcoming appointment data (name, date, time etc..) for a user. + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + name: + type: string + date: + type: string + time: + type: string + "400": + description: Bad request + "401": + description: Authorization information is missing or invalid + + /shared/projects/lcsection/{projectId}: get: summary: Retourne la liste de sections de LC avec un titre donné tags: @@ -172,18 +365,19 @@ paths: schema: type: integer required: true - - in: path - name: title - schema: - type: string - required: true - description: the name of lc section - - in: path - name: date - required: false - schema: - type: string - description: the date corresponding to the wanted version of lc section + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: integer + description: the number associated with the title of the lcsection + date: + type: string + description: the date corresponding to the wanted version of lc section responses: "200": description: OK @@ -239,7 +433,7 @@ paths: /shared/projects/admin/{projectId}: get: - summary: Retourne les inforùations de l'admin qui accompagne le projet + summary: Retourne les informations de l'admin qui accompagne le projet tags: - Shared API security: @@ -340,7 +534,65 @@ paths: "401": description: Authorization information is missing or invalid - + + /shared/appointments/request: + post: + summary: demander un rendez-vous + description: + will add an appointement request request by the applicant + to have an appointment to be confirmed or denied by the + specified participants of the appointement. + tags: + - Shared API + security: + - MyINPulse: + - MyINPulse-entrepreneur + - MyINPulse-admin + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + title: + type: string + start_time: + type: string + end_time: + type: string + place: + type: string + applicantId: + type: integer + participants: + type: array + items: + type: integer + + responses: + "200": + description: OK + "400": + description: Bad request + "401": + description: Authorization information is + missing or invalid + + + +# _____ _ _ _____ ____ _____ ____ ____ _____ _ _ _____ _ _ ____ +# | ____| \ | |_ _| _ \| ____| _ \| _ \| ____| \ | | ____| | | | _ \ +# | _| | \| | | | | |_) | _| | |_) | |_) | _| | \| | _| | | | | |_) | +# | |___| |\ | | | | _ <| |___| __/| _ <| |___| |\ | |___| |_| | _ < +# |_____|_|_\_| |_| |_| \_\_____|_| |_| \_\_____|_| \_|_____|\___/|_| \_\ +# / \ | _ \_ _| +# / _ \ | |_) | | +# / ___ \| __/| | +# /_/ \_\_| |___| +# + + /entrepreneur/projects/request: post: summary: demander la création et validation d'un projet @@ -373,101 +625,7 @@ paths: description: Authorization information is missing or invalid - /admin/projects/pending/decision: - post: - summary: valider un projet en attente de validation - tags: - - Admin API - description: - if the request is accepted the status of the - project is changed to ongoing, entrepreneur - account is confirmed and the project is linked - to the admin accepting the request and the - entrepreneur requesting it. Else the pending - project and user info are deleted. - security: - - MyINPulse: - - MyINPulse-admin - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - pedingProjectId: - type: integer - decision: - type: boolean - - responses: - "200": - description: OK - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid - - /admin/projects/add: - post: - summary: Ajout mannuel d'un projet - description: - Adds a project with the - inputed details - tags: - - Admin API - security: - - MyINPulse: - - MyINPulse-admin - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - name: - type: string - founder: - $ref: "#/components/schemas/user-entrepreneur" - - responses: - "200": - description: OK - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid - - /admin/projects/remove/{projectId}: - delete: - summary: supression d'un project - description: - Removes the project - with the inputed id projectId - tags: - - Admin API - security: - - MyINPulse: - - MyINPulse-admin - parameters: - - in: path - name: projectId - required: true - schema: - type: integer - - responses: - "200": - description: OK - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid - + /entrepreneur/lcsection/add/{projectId}: post: summary: ajouter une sections au LC @@ -567,88 +725,6 @@ paths: description: Authorization information is missing or invalid - /shared/appointments/request: - post: - summary: demander une rendez-vous - description: - will add an appointement request request by the applicant - to have an appointment to be confirmed or denied by the - specified participants of the appointement. - tags: - - Shared API - security: - - MyINPulse: - - MyINPulse-entrepreneur - - MyINPulse-admin - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - title: - type: string - start_time: - type: string - end_time: - type: string - place: - type: string - applicantId: - type: integer - participants: - type: array - items: - type: integer - - responses: - "200": - description: OK - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid - - /admin/appointments/report/{appointmentId}: - post: - summary: enregistrer une rapport du rendez-vous - description: - Generate a PDF file formatted - from input text and links it - to the appointement. - tags: - - Admin API - security: - - MyINPulse: - - MyINPulse-admin - parameters: - - in: path - name: appointmentId - required: true - schema: - type: integer - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - title: - type: string - body: - type: string - conclusion: - type: string - - responses: - "200": - description: OK - "400": - description: Bad request - "401": - description: Authorization information is - missing or invalid + + \ No newline at end of file From 067eeb9494774054c580e982285a1acb3381f377 Mon Sep 17 00:00:00 2001 From: MAILLAL Anas Date: Wed, 26 Feb 2025 11:31:45 +0100 Subject: [PATCH 4/4] docs: added examples and changed some weird character --- Documentation/openapi/main.yaml | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/Documentation/openapi/main.yaml b/Documentation/openapi/main.yaml index 00dc3d4..263e9ab 100644 --- a/Documentation/openapi/main.yaml +++ b/Documentation/openapi/main.yaml @@ -24,10 +24,13 @@ components: type: string email: type: string - scondaryEmail: + example: "example@exmaple.com" + secondaryEmail: type: string + example: "example@exmaple.com" tel: type: string + example: "0612345678" user-entrepreneur: type: object properties: @@ -36,12 +39,15 @@ components: entrepreneur: type: object properties: - ecole: + ecole: type: string + example: "enseirb" filiere: type: string + example: "info" status: - type: string + type: boolean + example: false user-admin: type: object properties: @@ -76,7 +82,7 @@ paths: - MyINPulse: - MyINPulse-admin description: - JSON array of who’s elements are objects containing necessary information for the view + JSON array of who's elements are objects containing necessary information for the view (project name, entrepreneur names, etc..) of the projects an admin is watching over. responses: @@ -283,7 +289,7 @@ paths: - MyINPulse: - MyINPulse-admin description: - JSON array of who’s elements are objects containing + JSON array of who's elements are objects containing necessary information for the view (project name, entrepreneur names, etc..) of all pending projects. responses: @@ -345,7 +351,7 @@ paths: "401": description: Authorization information is missing or invalid - /shared/projects/lcsection/{projectId}: + /shared/projects/lcsection/{projectId}/{title}/{date}: get: summary: Retourne la liste de sections de LC avec un titre donné tags: @@ -361,23 +367,26 @@ paths: date parameter is passed) parameters: - in: path + required: true name: projectId schema: type: integer + - in: path required: true - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - title: - type: integer - description: the number associated with the title of the lcsection - date: - type: string - description: the date corresponding to the wanted version of lc section + description: this number can be 1, 2,...,8. It is associated with the title of the lcsection + name: title + schema: + type: integer + enum: [1, 2, 3, 4, 5, 6, 7, 8] + + - in: path + required: true + name: date + description: the date corresponding to the wanted version of lc section. "Nan" for the latest version + example: "NaN" + schema: + type: string + responses: "200": description: OK @@ -549,6 +558,7 @@ paths: - MyINPulse-entrepreneur - MyINPulse-admin requestBody: + description: \"participants\" property is an array containing userids of the participants in the appointement required: true content: application/json: @@ -566,10 +576,11 @@ paths: applicantId: type: integer participants: + #/* */ type: array items: type: integer - + responses: "200": description: OK @@ -630,7 +641,7 @@ paths: post: summary: ajouter une sections au LC description: - Adds input data to the user’s LC + Adds input data to the user's LC with a specified title. tags: - Entrepreneurs API