revu du controleur de la fiche enquete

This commit is contained in:
2025-04-15 23:37:07 +01:00
parent 5c6f57c2d5
commit 501ef8558c

View File

@@ -311,6 +311,29 @@ public class EnqueteController {
}
}
@GetMapping("/fiche/nup-provisoir/{nupProvisoir}")
public ResponseEntity<?> getFicheEnqueteByNupProvisoir(@PathVariable String nupProvisoir) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getFicheEnqueteByNupProvisoir(nupProvisoir), "enquete trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
try {