Fix: merge
All checks were successful
Format / formatting (push) Successful in 7s
CI / build (push) Successful in 11s

This commit is contained in:
Théo Le Lez
2025-02-19 18:52:43 +01:00
6 changed files with 77 additions and 57 deletions

View File

@ -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
@ -34,8 +36,8 @@ public class AdminApi {
* @return a list of upcoming appointments for the current user
*/
@GetMapping("/admin/appointments/upcoming")
public Iterable<DelAppointment> getUpcomingAppointments() {
return adminApiService.getUpcomingAppointments();
public Iterable<Appointment> getUpcomingAppointments(@AuthenticationPrincipal Jwt principal) {
return adminApiService.getUpcomingAppointments(principal.getClaimAsString("email"));
}
/**
@ -44,13 +46,15 @@ public class AdminApi {
* @return a list of current unvalidated projects, waiting to be accepted
*/
@GetMapping("/admin/projects/pending")
public Iterable<DelProject> getPendingProjects() {
public Iterable<Project> getPendingProjects() {
return adminApiService.getPendingProjects();
}
/**
* 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")
@ -64,7 +68,7 @@ public class AdminApi {
* @return the status code of the request
*/
@PostMapping("/admin/project/add")
public void addNewProject(@RequestBody DelProject project) {
public void addNewProject(@RequestBody Project project) {
adminApiService.addNewProject(project);
}
@ -77,8 +81,11 @@ public class AdminApi {
*/
@PostMapping("/admin/appoitements/report/{appointmentId}")
public void createAppointmentReport(
@PathVariable String appointmentId, @RequestBody DelReport report) {
adminApiService.createAppointmentReport(appointmentId, report);
@PathVariable String appointmentId,
@RequestBody Report report,
@AuthenticationPrincipal Jwt principal) {
adminApiService.createAppointmentReport(
appointmentId, report, principal.getClaimAsString("email"));
}
/**