Updated Application Evaluation API to return single object response instead of array

This commit is contained in:
harish
2024-10-28 21:09:33 +05:30
parent 1031cfc7b5
commit 528d266cb8
10 changed files with 61 additions and 90 deletions

View File

@@ -39,21 +39,17 @@ public interface ApplicationEvaluationApi {
@Parameter(required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
@Parameter( required = true) @Valid @RequestBody ApplicationEvaluationRequest evaluationRequest);
@Operation(
summary = "API to get ApplicationEvaluation data for evaluation process",
@Operation(summary = "API to get ApplicationEvaluation data for evaluation process",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
})
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
HttpServletRequest request,
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
@Parameter(required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
@Operation(summary = "API to delete ApplicationEvaluation",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),

View File

@@ -38,14 +38,13 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
}
@Override
public ResponseEntity<Response<List<ApplicationEvaluationResponse>>> getApplicationEvaluationByApplicationId(
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
List<ApplicationEvaluationResponse> responseList =
applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId, assignedApplicationId);
ApplicationEvaluationResponse response = null;
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(responseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
}