Add few APIs related to call and Update Responses for Call Controller

This commit is contained in:
harish
2024-08-27 16:55:50 +05:30
parent 157168a59e
commit 21fc9a4b91
17 changed files with 136 additions and 36 deletions

View File

@@ -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)