mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-01 13:36:29 +00:00
Select all networks to prevent delete issues
This commit is contained in:
@@ -180,9 +180,14 @@ export async function rebuildClientAssociationsFromSiteResource(
|
|||||||
|
|
||||||
/////////// process the client-siteResource associations ///////////
|
/////////// process the client-siteResource associations ///////////
|
||||||
|
|
||||||
// get all of the clients associated with other resources in the same network,
|
// get all of the clients associated with other site resources that share
|
||||||
// joined through siteNetworks so we know which siteId each client belongs to
|
// any of the same sites as this site resource (via siteNetworks). We can't
|
||||||
const allUpdatedClientsFromOtherResourcesOnThisSite = siteResource.networkId
|
// simply filter by networkId since each site resource has its own network;
|
||||||
|
// two site resources serving the same site typically belong to different
|
||||||
|
// networks that both happen to include the site through siteNetworks.
|
||||||
|
const sitesListSiteIds = sitesList.map((s) => s.siteId);
|
||||||
|
const allUpdatedClientsFromOtherResourcesOnThisSite =
|
||||||
|
sitesListSiteIds.length > 0
|
||||||
? await trx
|
? await trx
|
||||||
.select({
|
.select({
|
||||||
clientId: clientSiteResourcesAssociationsCache.clientId,
|
clientId: clientSiteResourcesAssociationsCache.clientId,
|
||||||
@@ -202,7 +207,7 @@ export async function rebuildClientAssociationsFromSiteResource(
|
|||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
eq(siteResources.networkId, siteResource.networkId),
|
inArray(siteNetworks.siteId, sitesListSiteIds),
|
||||||
ne(
|
ne(
|
||||||
siteResources.siteResourceId,
|
siteResources.siteResourceId,
|
||||||
siteResource.siteResourceId
|
siteResource.siteResourceId
|
||||||
|
|||||||
Reference in New Issue
Block a user