Add notifications to single monitor
This commit is contained in:
1 parent
15defa33eb
commit
233be4cbda
1 file changed
+5
-1
@@ -280,7 +280,11 @@ const getMonitorStatsById = async (req) => {
|
|||||||
const getMonitorById = async (monitorId) => {
|
const getMonitorById = async (monitorId) => {
|
||||||
try {
|
try {
|
||||||
const monitor = await Monitor.findById(monitorId);
|
const monitor = await Monitor.findById(monitorId);
|
||||||
return monitor;
|
// Get notifications
|
||||||
|
const notifications = await Notification.find({
|
||||||
|
monitorId: monitorId,
|
||||||
|
});
|
||||||
|
return { ...monitor.toObject(), notifications };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user