From 7dd9e81d207d795ae6fa826ff0c3d1e6e57eca20 Mon Sep 17 00:00:00 2001 From: Markus Date: Wed, 17 Jul 2024 12:27:44 +0300 Subject: [PATCH] chore(elastic-upgrade): clean up returns and any type --- packages/migration/src/utils/elasticsearch-helper.ts | 3 +-- packages/search/src/features/search/handler.ts | 2 +- packages/search/src/features/search/service.ts | 8 +++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/migration/src/utils/elasticsearch-helper.ts b/packages/migration/src/utils/elasticsearch-helper.ts index bd8d5f7ff14..73f0cee6f3a 100644 --- a/packages/migration/src/utils/elasticsearch-helper.ts +++ b/packages/migration/src/utils/elasticsearch-helper.ts @@ -42,9 +42,8 @@ export const updateComposition = async ( ) } catch (e) { console.error(`updateComposition: error: ${e}`) + return } - - return } export const renameField = async ( diff --git a/packages/search/src/features/search/handler.ts b/packages/search/src/features/search/handler.ts index e95837878d4..6910de7d826 100644 --- a/packages/search/src/features/search/handler.ts +++ b/packages/search/src/features/search/handler.ts @@ -140,7 +140,7 @@ export async function getStatusWiseRegistrationCountHandler( } const response = await client.search< - any, + SearchDocument, { statusCounts: { buckets: Array<{ diff --git a/packages/search/src/features/search/service.ts b/packages/search/src/features/search/service.ts index 39ae68bcb20..10602a9b658 100644 --- a/packages/search/src/features/search/service.ts +++ b/packages/search/src/features/search/service.ts @@ -59,9 +59,9 @@ export const advancedSearch = async ( payload: ISearchCriteria ) => { const formattedParams = await formatSearchParams(payload, isExternalSearch) - let response + try { - response = await client.search(formattedParams, { + return await client.search(formattedParams, { ignore: !isExternalSearch ? [404] : undefined, meta: true }) @@ -71,8 +71,6 @@ export const advancedSearch = async ( } else { logger.error('Search error: ', error) } - return undefined + return } - - return response }