From 75a897716f437d1393982a68c3b7904e586544af Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 31 Jul 2024 20:22:11 -0700 Subject: [PATCH] Add notifcations to getMonitorById as well --- Server/db/mongo/modules/monitorModule.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server/db/mongo/modules/monitorModule.js b/Server/db/mongo/modules/monitorModule.js index 65dae92b2..9bca432c2 100644 --- a/Server/db/mongo/modules/monitorModule.js +++ b/Server/db/mongo/modules/monitorModule.js @@ -64,7 +64,8 @@ const getMonitorById = async (req, res) => { createdAt: sortOrder, }) .limit(limit); - const monitorWithChecks = { ...monitor.toObject(), checks }; + const notifications = await Notification.find({ monitorId: monitor._id }); + const monitorWithChecks = { ...monitor.toObject(), checks, notifications }; return monitorWithChecks; } catch (error) { throw error;