From f0d6143af270a0fd76f722a620f2b99fc2da4525 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Wed, 2 Feb 2022 18:18:45 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=92=20Added=20an=20endpoint=20to=20fet?= =?UTF-8?q?ch=20comicBook=20mongo=20docs=20via=20array=20of=20ids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/import.service.ts | 15 ++++++++++++++- services/search.service.ts | 4 +--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/services/import.service.ts b/services/import.service.ts index c20ac35..72d3cb2 100644 --- a/services/import.service.ts +++ b/services/import.service.ts @@ -32,7 +32,7 @@ SOFTWARE. */ "use strict"; -import { isNil, isUndefined, map } from "lodash"; +import { isDate, isNil, isUndefined, map } from "lodash"; import { Context, Service, @@ -383,6 +383,19 @@ export default class ImportService extends Service { return await Comic.findById(ctx.params.id); }, }, + getComicBooksByIds: { + rest: "POST /getComicBooksByIds", + params: { ids: "array" }, + handler: async (ctx: Context<{ ids: [string]}>) => { + console.log(ctx.params.ids); + const queryIds = ctx.params.ids.map((id) => new ObjectId(id)); + return await Comic.find({ + '_id': { + $in: queryIds, + } + }) + } + }, getComicBookGroups: { rest: "GET /getComicBookGroups", params: {}, diff --git a/services/search.service.ts b/services/search.service.ts index a4e717d..aa0f1eb 100644 --- a/services/search.service.ts +++ b/services/search.service.ts @@ -59,9 +59,7 @@ export default class SettingsService extends Service { "Issue: ", ctx.params.queryObject.issueName ); - if ( - isNull(ctx.params.queryObject.volumeName) - ) { + if (isNull(ctx.params.queryObject.volumeName)) { elasticSearchQuery = { match: { "rawFileDetails.name": {