feat: frontend call now include the token and send the email from the token to backen servie
This commit is contained in:
@ -5,6 +5,8 @@ import enseirb.myinpulse.service.AdminApiService;
|
||||
|
||||
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
|
||||
@ -24,8 +26,8 @@ public class AdminApi {
|
||||
* @return a list of all project managed by the current admin user
|
||||
*/
|
||||
@GetMapping("/admin/projects")
|
||||
public Iterable<Administrateurs> getProjects() {
|
||||
return adminApiService.getProjects();
|
||||
public Iterable<Administrateurs> getProjects(@AuthenticationPrincipal Jwt principal) {
|
||||
return adminApiService.getProjects(principal.getClaimAsString("email"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,8 +36,8 @@ public class AdminApi {
|
||||
* @return a list of upcoming appointments for the current user
|
||||
*/
|
||||
@GetMapping("/admin/appointments/upcoming")
|
||||
public Iterable<Appointment> getUpcomingAppointments() {
|
||||
return adminApiService.getUpcomingAppointments();
|
||||
public Iterable<Appointment> getUpcomingAppointments(@AuthenticationPrincipal Jwt principal) {
|
||||
return adminApiService.getUpcomingAppointments(principal.getClaimAsString("email"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,6 +53,8 @@ public class AdminApi {
|
||||
/**
|
||||
* Endpoint used to make a decision about a project.
|
||||
*
|
||||
* <p>The decision must contains the administrator
|
||||
*
|
||||
* @return the status code of the request
|
||||
*/
|
||||
@PostMapping("/admin/projects/decision")
|
||||
@ -77,8 +81,11 @@ public class AdminApi {
|
||||
*/
|
||||
@PostMapping("/admin/appoitements/report/{appointmentId}")
|
||||
public void createAppointmentReport(
|
||||
@PathVariable String appointmentId, @RequestBody Report report) {
|
||||
adminApiService.createAppointmentReport(appointmentId, report);
|
||||
@PathVariable String appointmentId,
|
||||
@RequestBody Report report,
|
||||
@AuthenticationPrincipal Jwt principal) {
|
||||
adminApiService.createAppointmentReport(
|
||||
appointmentId, report, principal.getClaimAsString("email"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user