mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-16 18:46:35 +02:00
Update the counts when deleting resources
This commit is contained in:
@@ -166,6 +166,24 @@ export async function deleteSite(
|
||||
site.orgId,
|
||||
trx
|
||||
);
|
||||
|
||||
if (resourceSideEffects.resources.length > 0) {
|
||||
await usageService.add(
|
||||
site.orgId,
|
||||
LimitId.PUBLIC_RESOURCES,
|
||||
-resourceSideEffects.resources.length,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
if (resourceSideEffects.siteResources.length > 0) {
|
||||
await usageService.add(
|
||||
site.orgId,
|
||||
LimitId.PRIVATE_RESOURCES,
|
||||
-resourceSideEffects.siteResources.length,
|
||||
trx
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
await runDeleteSiteAssociatedResourcesSideEffects(
|
||||
|
||||
@@ -129,6 +129,24 @@ export async function rejectSite(
|
||||
site.orgId,
|
||||
trx
|
||||
);
|
||||
|
||||
if (resourceSideEffects.resources.length > 0) {
|
||||
await usageService.add(
|
||||
site.orgId,
|
||||
LimitId.PUBLIC_RESOURCES,
|
||||
-resourceSideEffects.resources.length,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
if (resourceSideEffects.siteResources.length > 0) {
|
||||
await usageService.add(
|
||||
site.orgId,
|
||||
LimitId.PRIVATE_RESOURCES,
|
||||
-resourceSideEffects.siteResources.length,
|
||||
trx
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
await runDeleteSiteAssociatedResourcesSideEffects(resourceSideEffects);
|
||||
|
||||
Reference in New Issue
Block a user