Skip to content

Commit

Permalink
Merge pull request #763 from avniproject/WIP
Browse files Browse the repository at this point in the history
avniproject/avni-webapp#858 | Rename the catchment and user group if …
  • Loading branch information
himeshr authored Jul 25, 2024
2 parents f1bbdf5 + c7cfe88 commit 5032310
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public ResponseEntity<?> voidCatchment(@PathVariable("id") Long id) {
return ResponseEntity.badRequest().body(ReactAdminUtil.generateJsonError(String.format("AddressLevelType with id %d not found", id)));
}
catchment.setVoided(true);
catchment.setName(ReactAdminUtil.getVoidedName(catchment.getName(),catchment.getId()));
catchmentRepository.save(catchment);
return new ResponseEntity<>(CatchmentContract.fromEntity(catchment), HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.avni.server.framework.security.UserContextHolder;
import org.avni.server.service.GroupsService;
import org.avni.server.service.accessControl.AccessControlService;
import org.avni.server.util.ReactAdminUtil;
import org.avni.server.web.request.GroupContract;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -124,6 +125,7 @@ public ResponseEntity voidGroup(@PathVariable("id") Long id) {
return ResponseEntity.badRequest().body(String.format("Default group %s cannot be deleted", group.getName()));

group.setVoided(true);
group.setName((ReactAdminUtil.getVoidedName(group.getName(), group.getId())));
group.updateAudit();
groupRepository.save(group);

Expand Down

0 comments on commit 5032310

Please sign in to comment.