From 7476ebc7a2f493bd333002c8ffd295b3d7a238a6 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 29 May 2023 10:01:34 -0700 Subject: [PATCH] chore: format --- packages/backend/src/db/meilisearch.ts | 38 +++++++++++++------ packages/backend/src/services/note/delete.ts | 2 +- .../src/widgets/server-metric/meilisearch.vue | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index 120450ac4..95f57a42d 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -134,7 +134,9 @@ export default hasConfig followeeId: true, }, }); - const followIDs = followedUsers.map((user) => user.followeeId); + const followIDs = followedUsers.map( + (user) => user.followeeId, + ); if (followIDs.length === 0) return null; @@ -158,7 +160,9 @@ export default hasConfig followerId: true, }, }); - const followIDs = followedUsers.map((user) => user.followerId); + const followIDs = followedUsers.map( + (user) => user.followerId, + ); if (followIDs.length === 0) return null; @@ -270,20 +274,32 @@ export default hasConfig note = [note]; } - let deletionBatch = note.map((n) => { - if(n instanceof Note) { - return n.id; - } + let deletionBatch = note + .map((n) => { + if (n instanceof Note) { + return n.id; + } - if(n.length > 0) return n; + if (n.length > 0) return n; - logger.error(`Failed to delete note from Meilisearch, invalid post ID: ${JSON.stringify(n)}`) + logger.error( + `Failed to delete note from Meilisearch, invalid post ID: ${JSON.stringify( + n, + )}`, + ); - throw new Error(`Invalid note ID passed to meilisearch deleteNote: ${JSON.stringify(n)}`) - }).filter((el) => el !== null); + throw new Error( + `Invalid note ID passed to meilisearch deleteNote: ${JSON.stringify( + n, + )}`, + ); + }) + .filter((el) => el !== null); await posts.deleteDocuments(deletionBatch as string[]).then(() => { - logger.info(`submitted ${deletionBatch.length} large batch for deletion`) + logger.info( + `submitted ${deletionBatch.length} large batch for deletion`, + ); }); }, } diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index 285a08075..90175ccdc 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -121,7 +121,7 @@ export default async function ( userId: user.id, }); - if(meilisearch) { + if (meilisearch) { await meilisearch.deleteNotes(note.id); } } diff --git a/packages/client/src/widgets/server-metric/meilisearch.vue b/packages/client/src/widgets/server-metric/meilisearch.vue index a4a899200..8119ff537 100644 --- a/packages/client/src/widgets/server-metric/meilisearch.vue +++ b/packages/client/src/widgets/server-metric/meilisearch.vue @@ -33,7 +33,7 @@ function onStats(stats) { total_size = stats.meilisearch.size; index_count = stats.meilisearch.indexed_count; available = stats.meilisearch.health; - progress = (index_count / serverStats.notesCount); + progress = index_count / serverStats.notesCount; } onMounted(() => {