🎛 Tweaks to the DC++ downloads endpoint

This commit is contained in:
2022-07-28 09:11:44 -07:00
parent 3f37c43584
commit b0a7e42461
3 changed files with 13 additions and 14 deletions

View File

@@ -48,10 +48,10 @@ const LOCGSchema = mongoose.Schema({
potw: Number, potw: Number,
}); });
const DirectConnectBundleSchema = mongoose.Schema({ const DirectConnectBundleSchema = mongoose.Schema({
resultId: String,
bundleId: Number, bundleId: Number,
directoryIds: [String], name: String,
searchInstanceId: Number, size: String,
type: {},
}); });
const ComicSchema = mongoose.Schema( const ComicSchema = mongoose.Schema(

View File

@@ -301,28 +301,28 @@ export default class ImportService extends Service {
params: {}, params: {},
async handler( async handler(
ctx: Context<{ ctx: Context<{
comicObjectId: string; bundleId: String;
resultId: string; comicObjectId: String,
bundleId: string; name: String;
directoryIds: []; size: Number;
searchInstanceId: string; type: String;
}> }>
) { ) {
console.log(JSON.stringify(ctx.params, null, 2))
const comicObjectId = new ObjectId( const comicObjectId = new ObjectId(
ctx.params.comicObjectId ctx.params.comicObjectId
); );
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
Comic.findByIdAndUpdate( Comic.findByIdAndUpdate(
comicObjectId, comicObjectId,
{ {
$push: { $push: {
"acquisition.directconnect.downloads": { "acquisition.directconnect.downloads": {
resultId: ctx.params.resultId,
bundleId: ctx.params.bundleId, bundleId: ctx.params.bundleId,
directoryIds: name: ctx.params.name,
ctx.params.directoryIds, size: ctx.params.size,
searchInstanceId: type: ctx.params.type,
ctx.params.searchInstanceId,
}, },
}, },
}, },

View File

@@ -153,7 +153,6 @@ export default class SettingsService extends Service {
ctx: Context<{ bundleIds: [] }> ctx: Context<{ bundleIds: [] }>
) => { ) => {
// params: array of bundle IDs // params: array of bundle IDs
// construct the elasticsearch msearch query
if (!isNil(ctx.params.bundleIds)) { if (!isNil(ctx.params.bundleIds)) {
return await Comic.find({ return await Comic.find({
"acquisition.directconnect.downloads": { "acquisition.directconnect.downloads": {