refactored user,role and region code

This commit is contained in:
harish
2024-09-03 19:26:17 +05:30
parent 5b2cfcd594
commit e4e43f2a6c
3 changed files with 9 additions and 17 deletions

View File

@@ -111,14 +111,12 @@ public class RegionDao {
}
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)));
RegionEntity regionEntity = validateRegion(id);
return convertRegionEntityToRegionResponse(regionEntity);
}
public void deleteById(Long id) {
log.info("Deleting region with ID: {}", id);
regionRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG)));
validateRegion(id);
regionRepository.deleteById(id);
log.info("Region deleted with ID: {}", id);
}