package enseirb.myinpulse.controller; import enseirb.myinpulse.model.Project; import enseirb.myinpulse.model.SectionCell; 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 editSectionCell( @PathVariable Long sectionId, @RequestBody String content, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.editSectionCell( sectionId, content, principal.getClaimAsString("email")); } /** * TODO: checkReturn Type * *

Endpoint used to delete a LC section * * @return status code */ @DeleteMapping("/entrepreneur/lcsection/remove/{sectionId}") public void removeSectionCell( @PathVariable Long sectionId, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.removeSectionCell(sectionId, principal.getClaimAsString("email")); } /** * TODO: check return type * *

Endpoint used to create a new LC section * * @return status code */ @PostMapping("/entrepreneur/lcsection/add") // remove id from doc aswell public void addLCSection( @RequestBody SectionCell sectionCell, @AuthenticationPrincipal Jwt principal) { entrepreneurApiService.addSectionCell(sectionCell, 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")); } }