Add delete method

This commit is contained in:
Alex Holliday committed 2024-07-30 13:25:56 -07:00
1 parent 03ee67cfca
commit 1664bc09ea
2 files changed
+12 -5

No files matched your search

+10 -1
View File
@@ -1,5 +1,4 @@
const Notification = require("../../../models/Notification");
const Notification = require("../../../models/Notification");
/**
* Creates a new notification.
@@ -35,7 +34,17 @@ const getNotificationsByMonitorId = async (monitorId) => {
}
};
const deleteNotificationsByMonitorId = async (monitorId) => {
try {
const result = await Notification.deleteMany({ monitorId });
return result.deletedCount;
} catch (error) {
throw error;
}
};
module.exports = {
createNotification,
getNotificationsByMonitorId,
deleteNotificationsByMonitorId,
};