Add few APIs related to call and Update Responses for Call Controller
This commit is contained in:
@@ -76,7 +76,7 @@ public class RegionDao {
|
||||
|
||||
public RegionResponseBean updateRegion(Long id, RegionReq regionReq) {
|
||||
log.info("Updating region with ID: {}", id);
|
||||
RegionEntity existingRegion = getRegionById(id);
|
||||
RegionEntity existingRegion = validateRegion(id);
|
||||
log.info("Current region details: {}", existingRegion);
|
||||
log.info("New region details: {}", regionReq);
|
||||
String newStatus = regionReq.getStatus() != null ? regionReq.getStatus().getValue() : null;
|
||||
@@ -102,14 +102,19 @@ public class RegionDao {
|
||||
return Utils.convertObject(existingRegion, RegionResponseBean.class);
|
||||
}
|
||||
|
||||
public RegionEntity getRegionById(Long id) {
|
||||
public RegionEntity validateRegion(Long id) {
|
||||
log.info("Fetching region with ID: {}", id);
|
||||
RegionEntity regionEntity = regionRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG)));
|
||||
log.info("Region found: {}", regionEntity);
|
||||
return regionEntity;
|
||||
}
|
||||
|
||||
public RegionResponseBean getRegionById(Long id) {
|
||||
log.info("Fetching region with ID: {}", id);
|
||||
RegionEntity regionEntity = regionRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG)));
|
||||
return convertRegionEntityToRegionResponse(regionEntity);
|
||||
}
|
||||
public void deleteById(Long id) {
|
||||
log.info("Deleting region with ID: {}", id);
|
||||
regionRepository.findById(id)
|
||||
|
||||
Reference in New Issue
Block a user