backend-api #6
@@ -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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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 ?
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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 ?
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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) {}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>Endpoint used to delete a LC section
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return status code
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DeleteMapping("/entrepreneur/lcsection/remove/{sectionId}")
 | 
				
			||||||
 | 
					    public void removeLCSection(@PathVariable String sectionId) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * TODO
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>Endpoint used to request the creation of a new project
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return status code
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/entrepreneur/project/request")
 | 
				
			||||||
 | 
					    public void requestNewProject(@RequestBody Project project) {}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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 ?
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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 ?
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>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
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * <p>
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return a list of all project managed by the current admin user
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/shared/appointment/request")
 | 
				
			||||||
 | 
					    public void createAppointmentRequest(@RequestBody Appointment appointment) {}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package enseirb.myinpulse.api.datatypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Appointment {
 | 
				
			||||||
 | 
					    int validated;
 | 
				
			||||||
 | 
					    int[] akserId;
 | 
				
			||||||
 | 
					    int[] destId;
 | 
				
			||||||
 | 
					    String date; // TODO: date type ?
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -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 {}
 | 
				
			||||||
@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					package enseirb.myinpulse.api.datatypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Project {
 | 
				
			||||||
 | 
					    int projectId;
 | 
				
			||||||
 | 
					    String projectName;
 | 
				
			||||||
 | 
					    String projectDescription;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					package enseirb.myinpulse.api.datatypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ProjectDecision {
 | 
				
			||||||
 | 
					    int projectId;
 | 
				
			||||||
 | 
					    int adminId;
 | 
				
			||||||
 | 
					    int isAccepted;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					package enseirb.myinpulse.api.datatypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Report {
 | 
				
			||||||
 | 
					    int projectId;
 | 
				
			||||||
 | 
					    String reportContent;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user