Add delete method
This commit is contained in:
1 parent
03ee67cfca
commit
1664bc09ea
2 files changed
+12
-5
No files matched your search
@@ -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,
|
||||
};
|
||||
Reference in new issue
Block a user