Skip to content

Commit

Permalink
avniproject/avni-webapp#1213 | Create reset sync record with old pare…
Browse files Browse the repository at this point in the history
…nt id when parent is updated
  • Loading branch information
1t5j0y committed Sep 20, 2024
1 parent 36281a2 commit 18de096
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,13 @@ public AddressLevel update(LocationEditContract locationEditContract, Long id) {
}

public void updateParent(AddressLevel location, AddressLevel newParent) {
Long oldParentId = location.getParentId();
location.setLineage(updateLineage(location, newParent.getLineage()));
location.setParent(newParent);
locationRepository.save(location);
updateDescendantLocationLineage(locationRepository.findAllByParent(location), location.getLineage());
updateLocationMapping(location, newParent);
resetSyncService.recordLocationParentChange(location, location.getParentId());
resetSyncService.recordLocationParentChange(location, oldParentId);
}

private void updateParent(AddressLevel location, Long newParentId) {
Expand Down

0 comments on commit 18de096

Please sign in to comment.