From 46b78eaac30be26fe40520e97786563344af8403 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 30 Mar 2024 16:26:16 +0000 Subject: format: Add missing lint and format, and format the entire repo --- packages/shared/search.ts | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'packages/shared/search.ts') diff --git a/packages/shared/search.ts b/packages/shared/search.ts index 8422d79e..7cd81061 100644 --- a/packages/shared/search.ts +++ b/packages/shared/search.ts @@ -1,7 +1,9 @@ -import { MeiliSearch, Index } from "meilisearch"; -import serverConfig from "./config"; +import type { Index } from "meilisearch"; +import { MeiliSearch } from "meilisearch"; import { z } from "zod"; +import serverConfig from "./config"; + export const zBookmarkIdxSchema = z.object({ id: z.string(), userId: z.string(), @@ -51,15 +53,29 @@ export async function getSearchIdxClient(): Promise | null> const desiredSortableAttributes = ["createdAt"].sort(); const settings = await idxFound.getSettings(); - if (JSON.stringify(settings.filterableAttributes?.sort()) != JSON.stringify(desiredFilterableAttributes)) { - console.log(`[meilisearch] Updating desired filterable attributes to ${desiredFilterableAttributes} from ${settings.filterableAttributes}`); - const taskId = await idxFound.updateFilterableAttributes(desiredFilterableAttributes); + if ( + JSON.stringify(settings.filterableAttributes?.sort()) != + JSON.stringify(desiredFilterableAttributes) + ) { + console.log( + `[meilisearch] Updating desired filterable attributes to ${desiredFilterableAttributes} from ${settings.filterableAttributes}`, + ); + const taskId = await idxFound.updateFilterableAttributes( + desiredFilterableAttributes, + ); await searchClient.waitForTask(taskId.taskUid); } - if (JSON.stringify(settings.sortableAttributes?.sort()) != JSON.stringify(desiredSortableAttributes)) { - console.log(`[meilisearch] Updating desired sortable attributes to ${desiredSortableAttributes} from ${settings.sortableAttributes}`); - const taskId = await idxFound.updateSortableAttributes(desiredSortableAttributes); + if ( + JSON.stringify(settings.sortableAttributes?.sort()) != + JSON.stringify(desiredSortableAttributes) + ) { + console.log( + `[meilisearch] Updating desired sortable attributes to ${desiredSortableAttributes} from ${settings.sortableAttributes}`, + ); + const taskId = await idxFound.updateSortableAttributes( + desiredSortableAttributes, + ); await searchClient.waitForTask(taskId.taskUid); } idxClient = idxFound; -- cgit v1.2.3-70-g09d2