Commit 4af989c27874966cfae8f6e47b8baa86c132f74b
1 parent
d8d84b68
Unassign assets from removed customer.
Showing
1 changed file
with
5 additions
and
0 deletions
... | ... | @@ -28,6 +28,7 @@ import org.thingsboard.server.common.data.id.CustomerId; |
28 | 28 | import org.thingsboard.server.common.data.id.TenantId; |
29 | 29 | import org.thingsboard.server.common.data.page.TextPageData; |
30 | 30 | import org.thingsboard.server.common.data.page.TextPageLink; |
31 | +import org.thingsboard.server.dao.asset.AssetService; | |
31 | 32 | import org.thingsboard.server.dao.dashboard.DashboardService; |
32 | 33 | import org.thingsboard.server.dao.device.DeviceService; |
33 | 34 | import org.thingsboard.server.dao.entity.AbstractEntityService; |
... | ... | @@ -61,6 +62,9 @@ public class CustomerServiceImpl extends AbstractEntityService implements Custom |
61 | 62 | private TenantDao tenantDao; |
62 | 63 | |
63 | 64 | @Autowired |
65 | + private AssetService assetService; | |
66 | + | |
67 | + @Autowired | |
64 | 68 | private DeviceService deviceService; |
65 | 69 | |
66 | 70 | @Autowired |
... | ... | @@ -96,6 +100,7 @@ public class CustomerServiceImpl extends AbstractEntityService implements Custom |
96 | 100 | throw new IncorrectParameterException("Unable to delete non-existent customer."); |
97 | 101 | } |
98 | 102 | dashboardService.unassignCustomerDashboards(customer.getTenantId(), customerId); |
103 | + assetService.unassignCustomerAssets(customer.getTenantId(), customerId); | |
99 | 104 | deviceService.unassignCustomerDevices(customer.getTenantId(), customerId); |
100 | 105 | userService.deleteCustomerUsers(customer.getTenantId(), customerId); |
101 | 106 | deleteEntityRelations(customerId); | ... | ... |