From e7341b553de4dfe856dd425ff85a5213a5b71894 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Wed, 12 Jun 2024 21:42:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixed=20the=20paginated=20result?= =?UTF-8?q?=20of=20getComicsMarkedAsWanted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/library.service.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/services/library.service.ts b/services/library.service.ts index 4853c59..5abe27d 100644 --- a/services/library.service.ts +++ b/services/library.service.ts @@ -339,6 +339,9 @@ export default class LibraryService extends Service { ctx: Context<{ page: number; limit: number }> ) => { const { page, limit } = ctx.params; + this.logger.info( + `Requesting page ${page} with limit ${limit}` + ); try { const options = { page, @@ -364,15 +367,15 @@ export default class LibraryService extends Service { options ); - return { - wantedComics: result.docs, - total: result.totalDocs, - page: result.page, - limit: result.limit, - pages: result.totalPages, - }; + // Log the raw result from the database + this.logger.info( + "Paginate result:", + JSON.stringify(result, null, 2) + ); + + return result.docs; // Return just the docs array } catch (error) { - console.error("Error finding comics:", error); + this.logger.error("Error finding comics:", error); throw error; } },