🔧 Fixed getBundles endpoint

This commit is contained in:
2024-10-23 23:14:21 -04:00
parent d7e865f84f
commit 7381d03045

View File

@@ -792,19 +792,21 @@ export default class ImportService extends Service {
new ObjectId(ctx.params.comicObjectId)
);
// 2. Init AirDC++
// 3. Get the bundles for the comic object
const ADCPPSocket = new AirDCPPSocket(config);
await ADCPPSocket.connect();
// 3. Get the bundles for the comic object
if (comicObject) {
// make the call to get the bundles from AirDC++ using the bundleId
return comicObject.acquisition.directconnect.downloads.map(
async (bundle) =>
await ADCPPSocket.get(
`queue/bundles/${bundle.id}`
)
const bundles =
comicObject.acquisition.directconnect.downloads.map(
async (bundle) => {
return await ADCPPSocket.get(
`queue/bundles/${bundle.bundleId}`
);
}
return false;
);
return Promise.all(bundles);
}
} catch (error) {
throw new Errors.MoleculerError(
"Couldn't fetch bundles from AirDC++",