Merge pull request #1079 from bluewave-labs/fix/fe-be/notifications

fix/fe-be/notifications
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-10-29 10:52:57 +08:00
commit a6214f400d
1 file changed
+6 -3
+6 -3
View File
@@ -296,9 +296,12 @@ const getMonitorById = async (monitorId) => {
const notifications = await Notification.find({
monitorId: monitorId,
});
monitor.notifications = notifications;
const monitorWithNotifications = await monitor.save();
return monitorWithNotifications;
const updatedMonitor = await Monitor.findByIdAndUpdate(
monitorId,
{ notifications },
{ new: true }
).populate("notifications");
return updatedMonitor;
} catch (error) {
error.service = SERVICE_NAME;
error.method = "getMonitorById";