From 7381d030450426ada05b3c7c16eaaec18023f730 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Wed, 23 Oct 2024 23:14:21 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixed=20getBundles=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/library.service.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/services/library.service.ts b/services/library.service.ts index 84fd314..ecf6c44 100644 --- a/services/library.service.ts +++ b/services/library.service.ts @@ -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 Promise.all(bundles); } - - return false; } catch (error) { throw new Errors.MoleculerError( "Couldn't fetch bundles from AirDC++",