🔎 Support for downloads endpoint
This commit is contained in:
@@ -47,6 +47,12 @@ const LOCGSchema = mongoose.Schema({
|
|||||||
pulls: Number,
|
pulls: Number,
|
||||||
potw: Number,
|
potw: Number,
|
||||||
});
|
});
|
||||||
|
const DirectConnectBundleSchema = mongoose.Schema({
|
||||||
|
resultId: String,
|
||||||
|
bundleId: Number,
|
||||||
|
directoryIds: [String],
|
||||||
|
searchInstanceId: Number,
|
||||||
|
});
|
||||||
|
|
||||||
const ComicSchema = mongoose.Schema(
|
const ComicSchema = mongoose.Schema(
|
||||||
{
|
{
|
||||||
@@ -58,7 +64,7 @@ const ComicSchema = mongoose.Schema(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
userAddedMetadata: {
|
userAddedMetadata: {
|
||||||
tags: [],
|
tags: [String],
|
||||||
},
|
},
|
||||||
sourcedMetadata: {
|
sourcedMetadata: {
|
||||||
comicInfo: { type: mongoose.Schema.Types.Mixed, default: {} },
|
comicInfo: { type: mongoose.Schema.Types.Mixed, default: {} },
|
||||||
@@ -99,7 +105,13 @@ const ComicSchema = mongoose.Schema(
|
|||||||
name: String,
|
name: String,
|
||||||
},
|
},
|
||||||
release: {},
|
release: {},
|
||||||
directconnect: Array,
|
directconnect: {
|
||||||
|
downloads: {
|
||||||
|
type: [DirectConnectBundleSchema],
|
||||||
|
es_indexed: true,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
torrent: {
|
torrent: {
|
||||||
sourceApplication: String,
|
sourceApplication: String,
|
||||||
magnet: String,
|
magnet: String,
|
||||||
@@ -120,6 +132,19 @@ ComicSchema.plugin(mongoosastic, {
|
|||||||
ComicSchema.plugin(paginate);
|
ComicSchema.plugin(paginate);
|
||||||
|
|
||||||
const Comic = mongoose.model("Comic", ComicSchema);
|
const Comic = mongoose.model("Comic", ComicSchema);
|
||||||
|
// Comic.createMapping({
|
||||||
|
// analysis: {
|
||||||
|
// analyzer: {
|
||||||
|
// content: {
|
||||||
|
// type: "custom",
|
||||||
|
// tokenizer: "whitespace",
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// }).then((data) => {
|
||||||
|
// console.log("Mapping the index...")
|
||||||
|
// console.log(data)
|
||||||
|
// })
|
||||||
// const stream = Comic.synchronize();
|
// const stream = Comic.synchronize();
|
||||||
// let count = 0;
|
// let count = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const Issue = mongoose.Schema({
|
|||||||
});
|
});
|
||||||
const VolumeInformation = mongoose.Schema({
|
const VolumeInformation = mongoose.Schema({
|
||||||
_id: false,
|
_id: false,
|
||||||
aliases: [],
|
aliases: [String],
|
||||||
api_detail_url: String,
|
api_detail_url: String,
|
||||||
characters: [Things],
|
characters: [Things],
|
||||||
concepts: [Things],
|
concepts: [Things],
|
||||||
@@ -68,7 +68,7 @@ const ComicVineMetadataSchema = mongoose.Schema({
|
|||||||
api_detail_url: String,
|
api_detail_url: String,
|
||||||
has_staff_review: { type: mongoose.Schema.Types.Mixed },
|
has_staff_review: { type: mongoose.Schema.Types.Mixed },
|
||||||
|
|
||||||
cover_date: String,
|
cover_date: Date,
|
||||||
date_added: String,
|
date_added: String,
|
||||||
date_last_updated: String,
|
date_last_updated: String,
|
||||||
deck: String,
|
deck: String,
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ export default class QueueService extends Service {
|
|||||||
source: {
|
source: {
|
||||||
wanted: false,
|
wanted: false,
|
||||||
},
|
},
|
||||||
|
directconnect: {
|
||||||
|
downloads: [],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ export default class ImportService extends Service {
|
|||||||
wanted: boolean;
|
wanted: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
|
directconnect: {
|
||||||
|
downloads: [];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}>
|
}>
|
||||||
) {
|
) {
|
||||||
@@ -313,7 +316,7 @@ export default class ImportService extends Service {
|
|||||||
comicObjectId,
|
comicObjectId,
|
||||||
{
|
{
|
||||||
$push: {
|
$push: {
|
||||||
"acquisition.directconnect": {
|
"acquisition.directconnect.downloads": {
|
||||||
resultId: ctx.params.resultId,
|
resultId: ctx.params.resultId,
|
||||||
bundleId: ctx.params.bundleId,
|
bundleId: ctx.params.bundleId,
|
||||||
directoryIds:
|
directoryIds:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
|
|
||||||
import { DbMixin } from "../mixins/db.mixin";
|
import { DbMixin } from "../mixins/db.mixin";
|
||||||
import Comic from "../models/comic.model";
|
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";
|
import { eSClient } from "../models/comic.model";
|
||||||
const s = eSClient.helpers.msearch();
|
const s = eSClient.helpers.msearch();
|
||||||
|
|
||||||
@@ -154,36 +154,16 @@ export default class SettingsService extends Service {
|
|||||||
) => {
|
) => {
|
||||||
// params: array of bundle IDs
|
// params: array of bundle IDs
|
||||||
// construct the elasticsearch msearch query
|
// construct the elasticsearch msearch query
|
||||||
let elasticsearchQuery = {};
|
|
||||||
if (!isNil(ctx.params.bundleIds)) {
|
if (!isNil(ctx.params.bundleIds)) {
|
||||||
ctx.params.bundleIds.map(async (id) => {
|
return await Comic.find({
|
||||||
let foo = await eSClient.search({
|
"acquisition.directconnect.downloads": {
|
||||||
index: "comics",
|
$elemMatch: {
|
||||||
body: {
|
bundleId: {
|
||||||
query: {
|
$in: ctx.params.bundleIds,
|
||||||
nested: {
|
|
||||||
path: "acquisition",
|
|
||||||
query: {
|
|
||||||
bool: {
|
|
||||||
must: [
|
|
||||||
{
|
|
||||||
match: {
|
|
||||||
"acquisition.directconnect":
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inner_hits: {},
|
|
||||||
// ignore_unmapped: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(foo.body);
|
|
||||||
return foo.body;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "CommonJS",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"target": "es6",
|
"target": "ES2022",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"lib": ["es5", "es6", "dom", "dom.iterable"],
|
"lib": ["es5", "es6", "dom", "dom.iterable"],
|
||||||
|
|||||||
Reference in New Issue
Block a user