Add few APIs related to call and Update Responses for Call Controller
This commit is contained in:
@@ -12,6 +12,7 @@ import net.gepafin.tendermanagement.entities.RoleEntity;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.CreateCallResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.RoleResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
@@ -85,7 +86,7 @@ public interface CallApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/{callId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<CallEntity>> getCallById(
|
||||
ResponseEntity<Response<CreateCallResponseBean>> getCallById(
|
||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||
@Operation(summary = "Api to get all calls",
|
||||
responses = {
|
||||
@@ -98,6 +99,6 @@ public interface CallApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<List<CreateCallResponseBean>>> getAllCalls();
|
||||
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls();
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public interface RegionApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/{regionId}", produces = "application/json")
|
||||
ResponseEntity<Response<RegionEntity>> getRegionById(
|
||||
ResponseEntity<Response<RegionResponseBean>> getRegionById(
|
||||
@Parameter(description = "The region id", required = true) @PathVariable("regionId") Long regionId);
|
||||
|
||||
@Operation(summary = "Api to get all regions",
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface RoleApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/{roleId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<RoleEntity>> getRoleById(
|
||||
ResponseEntity<Response<RoleResponseBean>> getRoleById(
|
||||
@Parameter(description = "The role ID", required = true) @PathVariable("roleId") Long roleId);
|
||||
|
||||
@Operation(summary = "Api to get all roles",
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.gepafin.tendermanagement.entities.RoleEntity;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.CreateCallResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.RoleResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
@@ -57,16 +58,16 @@ public class CallApiController implements CallApi {
|
||||
}
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public ResponseEntity<Response<CallEntity>> getCallById(Long callId) {
|
||||
CallEntity callEntity = callService.getCallById(callId);
|
||||
public ResponseEntity<Response<CreateCallResponseBean>> getCallById(Long callId) {
|
||||
CreateCallResponseBean createCallResponseBean = callService.getCallById(callId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(callEntity, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
.body(new Response<>(createCallResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public ResponseEntity<Response<List<CreateCallResponseBean>>> getAllCalls() {
|
||||
List<CreateCallResponseBean> calls = callService.getAllCalls();
|
||||
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls() {
|
||||
List<CallDetailsResponseBean> calls = callService.getAllCalls();
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
|
||||
@@ -52,10 +52,10 @@ public class RegionApiController implements RegionApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<RegionEntity>> getRegionById(
|
||||
public ResponseEntity<Response<RegionResponseBean>> getRegionById(
|
||||
@PathVariable("regionId") Long regionId) {
|
||||
log.info("Get Region by ID - Region ID: {}", regionId);
|
||||
RegionEntity region = regionService.getRegionById(regionId);
|
||||
RegionResponseBean region = regionService.getRegionById(regionId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(region, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_REGION_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@@ -57,11 +57,11 @@ public class RoleApiController implements RoleApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<RoleEntity>> getRoleById(Long roleId) {
|
||||
public ResponseEntity<Response<RoleResponseBean>> getRoleById(Long roleId) {
|
||||
log.info("Get Role by ID - Role ID: {}", roleId);
|
||||
RoleEntity roleEntity = roleService.getRoleById(roleId);
|
||||
RoleResponseBean roleResponseBean = roleService.getRoleById(roleId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(roleEntity, Status.SUCCESS, Translator.toLocale(GepafinConstant.ROLE_FETCH_SUCCESS_MSG)));
|
||||
.body(new Response<>(roleResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.ROLE_FETCH_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user