diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/controller/JobLauncherController.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/controller/JobLauncherController.java index 83e1406e..8d62b2bd 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/controller/JobLauncherController.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/controller/JobLauncherController.java @@ -486,15 +486,18 @@ public ResponseEntity launchRegenerateSchoolReports(@RequestBody Student @PreAuthorize(PermissionsConstants.RUN_GRAD_ALGORITHM) @Operation(summary = "Re-Generate Student Reports for the given batchJobId", description = "Re-Generate Student Reports for the given batchJobId", tags = { "RE-RUN" }) @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"),@ApiResponse(responseCode = "500", description = "Internal Server Error")}) - public ResponseEntity launchRegenerateStudentReports(@RequestBody StudentSearchRequest searchRequest, @RequestParam String reportType) { + public ResponseEntity launchRegenerateStudentReports(@RequestBody StudentSearchRequest searchRequest, @RequestParam String reportType) { logger.info(" Re-Generating Student Reports by request for {} --------------------------------------------------------", reportType); + BatchJobResponse response = new BatchJobResponse(); try { List finalUUIDs = gradSchoolOfRecordFilter.filterStudents(searchRequest); logger.info(" Number of Students [{}] ---------------------------------------------------------", finalUUIDs.size()); int numberOfReports = restUtils.processStudentReports(finalUUIDs, reportType); - return ResponseEntity.ok(numberOfReports + " student " + reportType + " reports successfully"); + response.setMessage(numberOfReports + " student " + reportType + " reports successfully"); + return ResponseEntity.ok(response); } catch (Exception e) { - return ResponseEntity.status(500).body(e.getLocalizedMessage()); + response.setException(e.getLocalizedMessage()); + return ResponseEntity.status(500).body(response); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/BatchJobResponse.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/BatchJobResponse.java index 6b06f327..17dafcc4 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/BatchJobResponse.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/BatchJobResponse.java @@ -18,4 +18,5 @@ public class BatchJobResponse { private String localDownload; private String exception; + private String message; }