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

@@ -99,15 +99,13 @@ public class RoleDao {
}
public RoleResponseBean getRoleById(Long id) {
log.info("Fetching role with ID: {}", id);
RoleEntity roleEntity = roleRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.ROLE_NOT_FOUND)));
RoleEntity roleEntity = validateRole(id);
log.info("Role found: {}", roleEntity);
return convertRoleEntityToRoleResponse(roleEntity);
}
public void deleteById(Long id) {
log.info("Deleting role with ID: {}", id);
roleRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.ROLE_NOT_FOUND)));
validateRole(id);
roleRepository.deleteById(id);
log.info("Role deleted with ID: {}", id);
}