From 3e5acac55cb259bd890b7c6d5dca2b87d49e567b Mon Sep 17 00:00:00 2001 From: ukrocks007 Date: Fri, 26 Apr 2024 23:05:16 +0530 Subject: [PATCH] chore: Remove unused getCountByProductService method from SetupLinkController --- npm/src/controller/setup-link.ts | 7 ------- pages/api/v1/stats/product.ts | 21 ++------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/npm/src/controller/setup-link.ts b/npm/src/controller/setup-link.ts index f287fa127..6e016c852 100644 --- a/npm/src/controller/setup-link.ts +++ b/npm/src/controller/setup-link.ts @@ -522,11 +522,4 @@ export class SetupLinkController { return setupLink; } - - public async getCountByProductService(product: string, service: SetupLinkService) { - return await this.setupLinkStore.getCount({ - name: IndexNames.ProductService, - value: dbutils.keyFromParts(product, service), - }); - } } diff --git a/pages/api/v1/stats/product.ts b/pages/api/v1/stats/product.ts index b51504635..570cfdaa5 100644 --- a/pages/api/v1/stats/product.ts +++ b/pages/api/v1/stats/product.ts @@ -21,14 +21,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => { - const { connectionAPIController, directorySyncController, setupLinkController, samlFederatedController } = - await jackson(); + const { connectionAPIController, directorySyncController, samlFederatedController } = await jackson(); // Products must be an array of strings const products = req.body.products as string[]; - const type = req.body.type - ? (req.body.type as 'sso' | 'dsync' | 'setuplinkSSO' | 'setuplinkDSync' | 'samlFederation') - : undefined; + const type = req.body.type ? (req.body.type as 'sso' | 'dsync' | 'samlFederation') : undefined; // Validate products if (!products) { @@ -41,8 +38,6 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => { // Get counts for product let sso_connections_count = 0; let dsync_connections_count = 0; - let setup_link_sso_count = 0; - let setup_link_dsync_count = 0; let saml_federation_count = 0; for (const product of products) { @@ -60,16 +55,6 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => { dsync_connections_count += count || 0; } - if (!type || type === 'setuplinkSSO') { - const count = await setupLinkController.getCountByProductService(product, 'sso'); - setup_link_sso_count += count || 0; - } - - if (!type || type === 'setuplinkDSync') { - const count = await setupLinkController.getCountByProductService(product, 'dsync'); - setup_link_dsync_count += count || 0; - } - if (!type || type === 'samlFederation') { const count = await samlFederatedController.app.getCount({ name: IndexNames.Product, @@ -84,8 +69,6 @@ const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => { data: { sso_connections: sso_connections_count, dsync_connections: dsync_connections_count, - setup_link_sso: setup_link_sso_count, - setup_link_dsync: setup_link_dsync_count, saml_federation: saml_federation_count, }, });