Skip to content

Commit

Permalink
avniproject/avni-webapp#1290 | Rename Address level type on deletion …
Browse files Browse the repository at this point in the history
…so name can be reused
  • Loading branch information
1t5j0y committed Oct 3, 2024
1 parent 5cd554b commit b086797
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.avni.server.domain.AddressLevel;
import org.avni.server.domain.AddressLevelType;
import org.avni.server.domain.accessControl.PrivilegeType;
import org.avni.server.domain.util.EntityUtil;
import org.avni.server.service.LocationService;
import org.avni.server.service.accessControl.AccessControlService;
import org.avni.server.util.ReactAdminUtil;
Expand Down Expand Up @@ -120,6 +121,7 @@ public ResponseEntity<?> voidAddressLevelType(@PathVariable("id") Long id) {
return ResponseEntity.badRequest().body(ReactAdminUtil.generateJsonError(
String.format("Cannot delete '%s'. Sub location types or locations of this type exist. Please delete them to proceed.", addressLevelType.getName())));
}
addressLevelType.setName(EntityUtil.getVoidedName(addressLevelType.getName(), addressLevelType.getId()));
addressLevelType.setVoided(true);
return new ResponseEntity<>(addressLevelType, HttpStatus.OK);
}
Expand Down

0 comments on commit b086797

Please sign in to comment.