From 3cb12dab4fe79c42a5cfa42c9e79317666066976 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Tue, 18 Feb 2025 10:50:21 +0100 Subject: [PATCH] feat: created signature of all api functions --- .../java/enseirb/myinpulse/api/AdminApi.java | 78 +++++++++++++++++++ .../myinpulse/api/EntrepreneurApi.java | 51 ++++++++++++ .../java/enseirb/myinpulse/api/SharedApi.java | 78 +++++++++++++++++++ .../myinpulse/api/datatypes/Appointment.java | 8 ++ .../myinpulse/api/datatypes/LCSection.java | 7 ++ .../myinpulse/api/datatypes/Project.java | 7 ++ .../api/datatypes/ProjectDecision.java | 7 ++ .../myinpulse/api/datatypes/Report.java | 6 ++ 8 files changed, 242 insertions(+) create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/AdminApi.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/EntrepreneurApi.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/SharedApi.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Appointment.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/LCSection.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Project.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/ProjectDecision.java create mode 100644 MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Report.java diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/AdminApi.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/AdminApi.java new file mode 100644 index 0000000..da33b73 --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/AdminApi.java @@ -0,0 +1,78 @@ +package enseirb.myinpulse.api; + +import enseirb.myinpulse.api.datatypes.Project; +import enseirb.myinpulse.api.datatypes.ProjectDecision; + +import enseirb.myinpulse.api.datatypes.Report; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.*; + +@SpringBootApplication +@RestController +public class AdminApi { + + /** + * TODO + * + * @return a list of all project managed by the current admin user + */ + @GetMapping("/admin/projects") + public void getProjects() {} + + /** + * TODO: Why in admin instead of shared ? + * + * @return a list of upcoming appointments for the current user + */ + @GetMapping("/admin/appointments/upcoming") + public void getUpcomingAppointments() {} + + /** + * TODO + * + * @return a list of current unvalidated projects, waiting to be accepted + */ + @GetMapping("/admin/projects/pending") + public void getPendingProjects() {} + + /** + * TODO + * + *

Endpoint used to make a decision about a project. + * + * @return the status code of the request + */ + @PostMapping("/admin/projects/decision") + public void validateProject(@RequestBody ProjectDecision decision) {} + + /** + * TODO + * + *

Endpoint used to manually add a project by an admin + * + * @return the status code of the request + */ + @PostMapping("/admin/project/add") + public void addNewProject(@RequestBody Project project) {} + + /** + * TODO: shouldn't it be an UPDATE request ? + * + *

Endpoint used to add a new report to an appointment + * + * @return the status code of the request + */ + @PostMapping("/admin/appoitements/report/{appointmentId}") + public void createAppointmentReport( + @PathVariable String appointmentId, @RequestBody Report report) {} + + /** + * TODO: Shouldn't a project be kept in history ? 2 different endpoints ? + * + *

Endpoint used to completely remove a project. + * + * @return the status code of the request + */ + @DeleteMapping("/admin/projects/remove/{projectId}") + public void deleteProject(@PathVariable String projectId) {} +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/EntrepreneurApi.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/EntrepreneurApi.java new file mode 100644 index 0000000..4f1eef2 --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/EntrepreneurApi.java @@ -0,0 +1,51 @@ +package enseirb.myinpulse.api; + +import enseirb.myinpulse.api.datatypes.LCSection; +import enseirb.myinpulse.api.datatypes.Project; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.*; + +@SpringBootApplication +@RestController +public class EntrepreneurApi { + /** + * TODO + * + *

Endpoint used to update a LC section. + * + * @return status code + */ + @PutMapping("/entrepreneur/lcsection/modify/{sectionId}") + public void editLCSection(@PathVariable String sectionId, @RequestBody LCSection section) {} + + /** + * TODO + * + *

Endpoint used to delete a LC section + * + * @return status code + */ + @DeleteMapping("/entrepreneur/lcsection/remove/{sectionId}") + public void removeLCSection(@PathVariable String sectionId) {} + + /** + * TODO + * + *

Endpoint used to create a new LC section + * + * @return status code + */ + @PostMapping("/entrepreneur/lcsection/add/{sectionId}") + public void addLCSection(@PathVariable String sectionId, @RequestBody LCSection section) {} + + /** + * TODO + * + *

Endpoint used to request the creation of a new project + * + * @return status code + */ + @PostMapping("/entrepreneur/project/request") + public void requestNewProject(@RequestBody Project project) {} +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/SharedApi.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/SharedApi.java new file mode 100644 index 0000000..c71b5b5 --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/SharedApi.java @@ -0,0 +1,78 @@ +package enseirb.myinpulse.api; + +import enseirb.myinpulse.api.datatypes.Appointment; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.*; + +@SpringBootApplication +@RestController +public class SharedApi { + + /** + * TODO: It does not looks like a good id to have the title and the date in the url. What even + * TODO: is the title btw ? if this is the LC section, wouldn't it be better to use an ID ? + * TODO: choose return type, cf comment in LCSection + * + *

Endpoint used to get the data inside the lean canvas + * + * @return a list of lean canvas sections + */ + @GetMapping("/shared/project/lcsection/{projectId}/{title}/{date}") + public void getLCSection( + @PathVariable("projectId") String projectId, + @PathVariable("title") String title, + @PathVariable("date") String date) {} + + /** + * TODO + * + *

Endpoint used to get entrepreneurs details + * + * @return a list of all entrepreneurs in a project + */ + @GetMapping("/shared/entrepreneurs/{projectId}") + public void getEntrepreneursByProjectId(@PathVariable int projectId) {} + + /** + * TODO: is it really useful for the admin ? We can already get all the project of the current + * administrator. + * + *

Endpoint used to get the administrator of a project. + * + * @return a list of all project managed by the current admin user + */ + @GetMapping("/shared/projects/admin/{projectId}") + public void getAdminByProjectId(@PathVariable int projectId) {} + + /** + * TODO: Should it really be all appointments? all future appointments ? a flag to choose \\ + * TODO: between both ? + * + *

Endpoint used to get all appointments of a single project. + * + * @return a list of all appointments. + */ + @GetMapping("/shared/projects/appointments/{projectId}") + public void getAppointmentsByProjectId(@PathVariable int projectId) {} + + /** + * TODO: Shouldn't the last two parameters be swapped ? + * + *

Endpoint used to generate a PDF report + * + * @return a PDF file? TODO: how does that works ? + */ + @GetMapping("/shared/projects/appointments/report/{appointmentId}") + public void getPDFReport(@PathVariable int appointmentId) {} + + /** + * TODO + * + *

+ * + * @return a list of all project managed by the current admin user + */ + @PostMapping("/shared/appointment/request") + public void createAppointmentRequest(@RequestBody Appointment appointment) {} +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Appointment.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Appointment.java new file mode 100644 index 0000000..ba2187e --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Appointment.java @@ -0,0 +1,8 @@ +package enseirb.myinpulse.api.datatypes; + +public class Appointment { + int validated; + int[] akserId; + int[] destId; + String date; // TODO: date type ? +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/LCSection.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/LCSection.java new file mode 100644 index 0000000..0af17e3 --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/LCSection.java @@ -0,0 +1,7 @@ +package enseirb.myinpulse.api.datatypes; + +// TODO: is this redundant with the Section class from the database ? +// TODO: In the one hand it represent the same data, and on the other it should be much lighter. +// TODO: btw why does a LC section have an administrator ? + +public class LCSection {} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Project.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Project.java new file mode 100644 index 0000000..a6ab98f --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Project.java @@ -0,0 +1,7 @@ +package enseirb.myinpulse.api.datatypes; + +public class Project { + int projectId; + String projectName; + String projectDescription; +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/ProjectDecision.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/ProjectDecision.java new file mode 100644 index 0000000..ab3387b --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/ProjectDecision.java @@ -0,0 +1,7 @@ +package enseirb.myinpulse.api.datatypes; + +public class ProjectDecision { + int projectId; + int adminId; + int isAccepted; +} diff --git a/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Report.java b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Report.java new file mode 100644 index 0000000..3656014 --- /dev/null +++ b/MyINPulse-back/src/main/java/enseirb/myinpulse/api/datatypes/Report.java @@ -0,0 +1,6 @@ +package enseirb.myinpulse.api.datatypes; + +public class Report { + int projectId; + String reportContent; +}