From 233be4cbda62b65bdb04ff413be8f28318c078f2 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 30 Aug 2024 10:46:51 -0700 Subject: [PATCH] Add notifications to single monitor --- Server/db/mongo/modules/monitorModule.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Server/db/mongo/modules/monitorModule.js b/Server/db/mongo/modules/monitorModule.js index 7a86f1891..e2e93bcfb 100644 --- a/Server/db/mongo/modules/monitorModule.js +++ b/Server/db/mongo/modules/monitorModule.js @@ -280,7 +280,11 @@ const getMonitorStatsById = async (req) => { const getMonitorById = async (monitorId) => { try { const monitor = await Monitor.findById(monitorId); - return monitor; + // Get notifications + const notifications = await Notification.find({ + monitorId: monitorId, + }); + return { ...monitor.toObject(), notifications }; } catch (error) { throw error; }