From 95a451ace9abfa6599bc0803b90aa86ebd78825c Mon Sep 17 00:00:00 2001 From: Adam King Date: Fri, 21 May 2021 15:33:58 -0400 Subject: [PATCH] Omit deleted resources from applyQueryFields results --- app/apollo/utils/applyQueryFields.js | 2 +- app/routes/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/apollo/utils/applyQueryFields.js b/app/apollo/utils/applyQueryFields.js index 4981e3a41..6458f7a23 100644 --- a/app/apollo/utils/applyQueryFields.js +++ b/app/apollo/utils/applyQueryFields.js @@ -249,7 +249,7 @@ const applyQueryFieldsToSubscriptions = async(subs, queryFields={}, args, contex }); } if(queryFields.resources){ - const search = { org_id: orgId, 'searchableData.subscription_id': { $in: subUuids } }; + const search = { org_id: orgId, 'searchableData.subscription_id': { $in: subUuids }, deleted: false }; if (servSub) delete search.org_id; // service subscriptions push resources to different orgs var resources = await loadResourcesWithSearchAndArgs({ search, diff --git a/app/routes/index.js b/app/routes/index.js index 55e06b32e..e637222b5 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -207,8 +207,8 @@ async function initialize(){ options: { name: 'org_id.cluster_id.subid.deleted', } }, { - keys: { 'searchableData.subscription_id': 1}, - options: { name: 'searchableData.subscription_id', } + keys: { 'searchableData.subscription_id': 1, deleted: 1}, + options: { name: 'searchableData.subscription_id.deleted', } }, { keys: { org_id: 1, cluster_id: 1, 'searchableData.kind': 1, 'searchableData.children': 1, deleted: 1 },