From 00b179e6b3ea9a454bfe886a55391f36b2069cad Mon Sep 17 00:00:00 2001 From: Vito0912 <86927734+Vito0912@users.noreply.github.com> Date: Wed, 1 Jan 2025 20:35:09 +0100 Subject: [PATCH] fixed controller to include id of library without changing the schema --- server/controllers/LibraryController.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index b7e6abaef..b5d37f50d 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -62,11 +62,8 @@ class LibraryController { // Fetch stats for the current library const libraryStats = await libraryHelpers.getLibraryStats(req); - // Add the libraries id to the stats - libraryStats.id = library.id; - // Add this library's stats to the array of individual stats - allStats.push(libraryStats); + allStats.push({ [library.id]: libraryStats }); // Combine all stats for (const [key, value] of Object.entries(libraryStats)) {