⬇️ Support for multiple bundles in comic model
This commit is contained in:
@@ -46,7 +46,7 @@ const ComicSchema = mongoose.Schema({
|
|||||||
acquisition: {
|
acquisition: {
|
||||||
wanted: Boolean,
|
wanted: Boolean,
|
||||||
release: {},
|
release: {},
|
||||||
directconnect: {},
|
directconnect: Array,
|
||||||
torrent: {
|
torrent: {
|
||||||
sourceApplication: String,
|
sourceApplication: String,
|
||||||
magnet: String,
|
magnet: String,
|
||||||
|
|||||||
@@ -70,10 +70,10 @@ export default class ProductsService extends Service {
|
|||||||
};
|
};
|
||||||
}>
|
}>
|
||||||
) {
|
) {
|
||||||
console.log("ASDASD", ctx.params);
|
|
||||||
let volumeDetails;
|
let volumeDetails;
|
||||||
const comicMetadata = ctx.params;
|
const comicMetadata = ctx.params;
|
||||||
if (comicMetadata.sourcedMetadata.comicvine &&
|
if (
|
||||||
|
comicMetadata.sourcedMetadata.comicvine &&
|
||||||
!isNil(
|
!isNil(
|
||||||
comicMetadata.sourcedMetadata.comicvine
|
comicMetadata.sourcedMetadata.comicvine
|
||||||
.volume
|
.volume
|
||||||
@@ -161,7 +161,8 @@ export default class ProductsService extends Service {
|
|||||||
ctx: Context<{
|
ctx: Context<{
|
||||||
comicObjectId: string;
|
comicObjectId: string;
|
||||||
resultId: string;
|
resultId: string;
|
||||||
downloadResult: {};
|
bundleId: string;
|
||||||
|
directoryIds: [];
|
||||||
searchInstanceId: string;
|
searchInstanceId: string;
|
||||||
}>
|
}>
|
||||||
) {
|
) {
|
||||||
@@ -169,21 +170,30 @@ export default class ProductsService extends Service {
|
|||||||
ctx.params.comicObjectId
|
ctx.params.comicObjectId
|
||||||
);
|
);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Comic.findByIdAndUpdate(comicObjectId, {
|
Comic.findByIdAndUpdate(
|
||||||
acquisition: {
|
comicObjectId,
|
||||||
directconnect: {
|
{
|
||||||
resultId: ctx.params.resultId,
|
$push: {
|
||||||
downloadResult: ctx.params.downloadResult,
|
"acquisition.directconnect": {
|
||||||
searchInstanceId: ctx.params.searchInstanceId,
|
resultId:
|
||||||
}
|
ctx.params.resultId,
|
||||||
}
|
bundleId: ctx.params.bundleId,
|
||||||
}, { new: true}, (err, result) =>{
|
directoryIds: ctx.params.directoryIds,
|
||||||
if(err) {
|
searchInstanceId:
|
||||||
|
ctx.params
|
||||||
|
.searchInstanceId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ new: true, safe: true, upsert: true },
|
||||||
|
(err, result) => {
|
||||||
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user