Add notifcations to getMonitorById as well

This commit is contained in:
Alex Holliday
2024-07-31 20:22:11 -07:00
parent b126830110
commit 75a897716f
+2 -1
View File
@@ -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;