🔎 Support for downloads endpoint
This commit is contained in:
@@ -124,6 +124,9 @@ export default class QueueService extends Service {
|
||||
source: {
|
||||
wanted: false,
|
||||
},
|
||||
directconnect: {
|
||||
downloads: [],
|
||||
}
|
||||
},
|
||||
});
|
||||
return {
|
||||
|
||||
@@ -186,6 +186,9 @@ export default class ImportService extends Service {
|
||||
wanted: boolean;
|
||||
name?: string;
|
||||
};
|
||||
directconnect: {
|
||||
downloads: [];
|
||||
};
|
||||
};
|
||||
}>
|
||||
) {
|
||||
@@ -313,7 +316,7 @@ export default class ImportService extends Service {
|
||||
comicObjectId,
|
||||
{
|
||||
$push: {
|
||||
"acquisition.directconnect": {
|
||||
"acquisition.directconnect.downloads": {
|
||||
resultId: ctx.params.resultId,
|
||||
bundleId: ctx.params.bundleId,
|
||||
directoryIds:
|
||||
@@ -513,7 +516,7 @@ export default class ImportService extends Service {
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
libraryStatistics: {
|
||||
rest: "GET /libraryStatistics",
|
||||
params: {},
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
|
||||
import { DbMixin } from "../mixins/db.mixin";
|
||||
import Comic from "../models/comic.model";
|
||||
import { flatten, isEmpty, isNil, isUndefined, map } from "lodash";
|
||||
import { flatten, isEmpty, isNil, isUndefined, map, result } from "lodash";
|
||||
import { eSClient } from "../models/comic.model";
|
||||
const s = eSClient.helpers.msearch();
|
||||
|
||||
@@ -154,35 +154,15 @@ export default class SettingsService extends Service {
|
||||
) => {
|
||||
// params: array of bundle IDs
|
||||
// construct the elasticsearch msearch query
|
||||
let elasticsearchQuery = {};
|
||||
if (!isNil(ctx.params.bundleIds)) {
|
||||
ctx.params.bundleIds.map(async (id) => {
|
||||
let foo = await eSClient.search({
|
||||
index: "comics",
|
||||
body: {
|
||||
query: {
|
||||
nested: {
|
||||
path: "acquisition",
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
{
|
||||
match: {
|
||||
"acquisition.directconnect":
|
||||
id,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
inner_hits: {},
|
||||
// ignore_unmapped: true,
|
||||
},
|
||||
return await Comic.find({
|
||||
"acquisition.directconnect.downloads": {
|
||||
$elemMatch: {
|
||||
bundleId: {
|
||||
$in: ctx.params.bundleIds,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(foo.body);
|
||||
return foo.body;
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user