🔧 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) new ObjectId(ctx.params.comicObjectId)
); );
// 2. Init AirDC++ // 2. Init AirDC++
// 3. Get the bundles for the comic object
const ADCPPSocket = new AirDCPPSocket(config); const ADCPPSocket = new AirDCPPSocket(config);
await ADCPPSocket.connect();
// 3. Get the bundles for the comic object
if (comicObject) { if (comicObject) {
// make the call to get the bundles from AirDC++ using the bundleId // make the call to get the bundles from AirDC++ using the bundleId
return comicObject.acquisition.directconnect.downloads.map( const bundles =
async (bundle) => comicObject.acquisition.directconnect.downloads.map(
await ADCPPSocket.get( async (bundle) => {
`queue/bundles/${bundle.id}` return await ADCPPSocket.get(
) `queue/bundles/${bundle.bundleId}`
); );
}
);
return Promise.all(bundles);
} }
return false;
} catch (error) { } catch (error) {
throw new Errors.MoleculerError( throw new Errors.MoleculerError(
"Couldn't fetch bundles from AirDC++", "Couldn't fetch bundles from AirDC++",