From 40ad37b870d32f79aedd3605575e41b2c53d116f Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Fri, 26 May 2023 10:55:51 +0200 Subject: [PATCH] Default meilisearch data response + linting + prettyfier --- packages/backend/src/daemons/server-stats.ts | 6 +++++- .../src/queue/processors/background/index-all-notes.ts | 6 +++--- packages/backend/src/server/api/endpoints/server-info.ts | 7 +++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 4227ce6ee..2f1dd42ae 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -85,6 +85,10 @@ async function meilisearchStatus() { if (meilisearch) { return meilisearch.serverStats(); } else { - return null; + return { + health: "unconfigured", + size: 0, + indexed_count: 0, + }; } } diff --git a/packages/backend/src/queue/processors/background/index-all-notes.ts b/packages/backend/src/queue/processors/background/index-all-notes.ts index 9bc53d2d3..646984c93 100644 --- a/packages/backend/src/queue/processors/background/index-all-notes.ts +++ b/packages/backend/src/queue/processors/background/index-all-notes.ts @@ -1,8 +1,8 @@ import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; -import { Notes } from "@/models/index.js"; -import { MoreThan } from "typeorm"; +import {queueLogger} from "../../logger.js"; +import {Notes} from "@/models/index.js"; +import {MoreThan} from "typeorm"; import {index} from "@/services/note/create.js"; import {Note} from "@/models/entities/note.js"; import meilisearch from "../../../db/meilisearch.js"; diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 5ba920301..cc9aa91b2 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -34,7 +34,6 @@ export default define(meta, paramDef, async () => { total: fsStats[0].size, used: fsStats[0].used, }, - meilisearch: meilisearchStats, }; }); @@ -42,6 +41,10 @@ async function meilisearchStatus() { if (meilisearch) { return meilisearch.serverStats(); } else { - return null; + return { + health: "unconfigured", + size: 0, + indexed_count: 0, + }; } }