feat: frontend call now include the token and send the email from the token to backen servie
This commit is contained in:
@ -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"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user