feat: frontend call now include the token and send the email from the token to backen servie
All checks were successful
Format / formatting (push) Successful in 6s
CI / build (push) Successful in 11s

This commit is contained in:
Pierre Tellier
2025-02-19 12:09:37 +01:00
parent 04a73073c1
commit 4698aa549f
6 changed files with 72 additions and 50 deletions

View File

@ -6,6 +6,8 @@ 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
@ -27,8 +29,12 @@ public class EntrepreneurApi {
* @return status code
*/
@PutMapping("/entrepreneur/lcsection/modify/{sectionId}")
public void editLCSection(@PathVariable String sectionId, @RequestBody LCSection section) {
entrepreneurApiService.editLCSection(sectionId, section);
public void editLCSection(
@PathVariable String sectionId,
@RequestBody LCSection section,
@AuthenticationPrincipal Jwt principal) {
entrepreneurApiService.editLCSection(
sectionId, section, principal.getClaimAsString("email"));
}
/**
@ -39,8 +45,9 @@ public class EntrepreneurApi {
* @return status code
*/
@DeleteMapping("/entrepreneur/lcsection/remove/{sectionId}")
public void removeLCSection(@PathVariable String sectionId) {
entrepreneurApiService.removeLCSection(sectionId);
public void removeLCSection(
@PathVariable String sectionId, @AuthenticationPrincipal Jwt principal) {
entrepreneurApiService.removeLCSection(sectionId, principal.getClaimAsString("email"));
}
/**
@ -51,8 +58,12 @@ public class EntrepreneurApi {
* @return status code
*/
@PostMapping("/entrepreneur/lcsection/add/{sectionId}")
public void addLCSection(@PathVariable String sectionId, @RequestBody LCSection section) {
entrepreneurApiService.addLCSection(sectionId, section);
public void addLCSection(
@PathVariable String sectionId,
@RequestBody LCSection section,
@AuthenticationPrincipal Jwt principal) {
entrepreneurApiService.addLCSection(
sectionId, section, principal.getClaimAsString("email"));
}
/**
@ -63,7 +74,8 @@ public class EntrepreneurApi {
* @return status code
*/
@PostMapping("/entrepreneur/project/request")
public void requestNewProject(@RequestBody Project project) {
entrepreneurApiService.requestNewProject(project);
public void requestNewProject(
@RequestBody Project project, @AuthenticationPrincipal Jwt principal) {
entrepreneurApiService.requestNewProject(project, principal.getClaimAsString("email"));
}
}