Compare commits

...

2 Commits

Author SHA1 Message Date
Utkarsh Mehta fcabd7200a
Merge 3e5acac55c into 413f68e45e 2024-04-26 23:05:21 +05:30
ukrocks007 3e5acac55c chore: Remove unused getCountByProductService method from SetupLinkController 2024-04-26 23:05:16 +05:30
2 changed files with 2 additions and 26 deletions

View File

@ -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),
});
}
}

View File

@ -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,
},
});