From a0de1e3c720b2b45c4f5d8b472dce3b00c0144b5 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 9 Jun 2025 12:58:25 +0800 Subject: [PATCH] remove old notificaiton code --- server/db/mongo/modules/monitorModule.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/server/db/mongo/modules/monitorModule.js b/server/db/mongo/modules/monitorModule.js index 8e44daea7..3d9adab39 100755 --- a/server/db/mongo/modules/monitorModule.js +++ b/server/db/mongo/modules/monitorModule.js @@ -500,14 +500,6 @@ const getMonitorById = async (monitorId) => { error.status = 404; throw error; } - // Get notifications - const notifications = await Notification.find({ - monitorId: monitorId, - }); - - // Update monitor with notifications and save - monitor.notifications = notifications; - await monitor.save(); return monitor; } catch (error) { @@ -664,10 +656,8 @@ const getMonitorsWithChecksByTeamId = async (req) => { const createMonitor = async (req, res) => { try { const monitor = new Monitor({ ...req.body }); - // Remove notifications fom monitor as they aren't needed here - monitor.notifications = undefined; - await monitor.save(); - return monitor; + const saved = await monitor.save(); + return saved; } catch (error) { error.service = SERVICE_NAME; error.method = "createMonitor"; @@ -764,8 +754,6 @@ const deleteMonitorsByUserId = async (userId) => { * @throws {Error} */ const editMonitor = async (candidateId, candidateMonitor) => { - candidateMonitor.notifications = undefined; - try { const editedMonitor = await Monitor.findByIdAndUpdate(candidateId, candidateMonitor, { new: true,