feat: continued implementing adminApiService

This commit is contained in:
Théo Le Lez
2025-03-12 12:16:01 +01:00
parent ef964c4d35
commit 8d486dce89
8 changed files with 158 additions and 18 deletions

View File

@ -1,5 +1,6 @@
package enseirb.myinpulse.controller;
import com.itextpdf.text.DocumentException;
import enseirb.myinpulse.model.*;
import enseirb.myinpulse.service.SharedApiService;
@ -9,6 +10,9 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.web.bind.annotation.*;
import java.io.File;
import java.io.FileNotFoundException;
@SpringBootApplication
@RestController
public class SharedApi {
@ -78,7 +82,11 @@ public class SharedApi {
@GetMapping("/shared/projects/appointments/report/{appointmentId}")
public void getPDFReport(
@PathVariable int appointmentId, @AuthenticationPrincipal Jwt principal) {
sharedApiService.getPDFReport(appointmentId, principal.getClaimAsString("email"));
try {
sharedApiService.getPDFReport(appointmentId, principal.getClaimAsString("email"));
} catch (FileNotFoundException | DocumentException e) {
System.out.println(e);
}
}
/**