🍒 Added an endpoint to fetch comicBook mongo docs via array of ids

This commit is contained in:
2022-02-02 18:18:45 -08:00
parent da61e695e7
commit f0d6143af2
2 changed files with 15 additions and 4 deletions

View File

@@ -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: {},

View File

@@ -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": {