Add notifications to single monitor

This commit is contained in:
Alex Holliday
2024-08-30 10:46:51 -07:00
parent 15defa33eb
commit 233be4cbda

View File

@@ -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;
}