package enseirb.myinpulse.controller; import enseirb.myinpulse.model.LCSection; import enseirb.myinpulse.model.Project; import enseirb.myinpulse.service.EntrepreneurApiService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.web.bind.annotation.*; @SpringBootApplication @RestController public class EntrepreneurApi { private final EntrepreneurApiService entrepreneurApiService; @Autowired EntrepreneurApi(EntrepreneurApiService entrepreneurApiService) { this.entrepreneurApiService = entrepreneurApiService; } /** * TODO: check return type * *
Endpoint used to update a LC section. * * @return status code */ @PutMapping("/entrepreneur/lcsection/modify/{sectionId}") public void editLCSection( @PathVariable String sectionId, @RequestBody LCSection section, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.editLCSection( sectionId, section, principal.getClaimAsString("email")); } /** * TODO: checkReturn Type * *
Endpoint used to delete a LC section * * @return status code */ @DeleteMapping("/entrepreneur/lcsection/remove/{sectionId}") public void removeLCSection( @PathVariable String sectionId, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.removeLCSection(sectionId, principal.getClaimAsString("email")); } /** * TODO: check return type * *
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, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.addLCSection( sectionId, section, principal.getClaimAsString("email")); } /** * TODO: check return type * *
Endpoint used to request the creation of a new project * * @return status code */ @PostMapping("/entrepreneur/project/request") public void requestNewProject( @RequestBody Project project, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.requestNewProject(project, principal.getClaimAsString("email")); } }