Add delete method
This commit is contained in:
1 parent
03ee67cfca
commit
1664bc09ea
2 files changed
+12
-5
No files matched your search
@@ -65,8 +65,6 @@ const {
|
|||||||
getAllMonitors,
|
getAllMonitors,
|
||||||
getMonitorById,
|
getMonitorById,
|
||||||
getMonitorsByUserId,
|
getMonitorsByUserId,
|
||||||
getMonitorByIdForIncidents,
|
|
||||||
getMonitorsByUserIdForIncidents,
|
|
||||||
createMonitor,
|
createMonitor,
|
||||||
deleteMonitor,
|
deleteMonitor,
|
||||||
deleteAllMonitors,
|
deleteAllMonitors,
|
||||||
@@ -123,6 +121,7 @@ const {
|
|||||||
const {
|
const {
|
||||||
createNotification,
|
createNotification,
|
||||||
getNotificationsByMonitorId,
|
getNotificationsByMonitorId,
|
||||||
|
deleteNotificationsByMonitorId,
|
||||||
} = require("./modules/notificationModule");
|
} = require("./modules/notificationModule");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -141,8 +140,6 @@ module.exports = {
|
|||||||
getAllMonitors,
|
getAllMonitors,
|
||||||
getMonitorById,
|
getMonitorById,
|
||||||
getMonitorsByUserId,
|
getMonitorsByUserId,
|
||||||
getMonitorByIdForIncidents,
|
|
||||||
getMonitorsByUserIdForIncidents,
|
|
||||||
createMonitor,
|
createMonitor,
|
||||||
deleteMonitor,
|
deleteMonitor,
|
||||||
deleteAllMonitors,
|
deleteAllMonitors,
|
||||||
@@ -169,4 +166,5 @@ module.exports = {
|
|||||||
deleteMaintenanceWindowByUserId,
|
deleteMaintenanceWindowByUserId,
|
||||||
createNotification,
|
createNotification,
|
||||||
getNotificationsByMonitorId,
|
getNotificationsByMonitorId,
|
||||||
|
deleteNotificationsByMonitorId,
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
const Notification = require("../../../models/Notification");
|
const Notification = require("../../../models/Notification");
|
||||||
const Notification = require("../../../models/Notification");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new 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 = {
|
module.exports = {
|
||||||
createNotification,
|
createNotification,
|
||||||
getNotificationsByMonitorId,
|
getNotificationsByMonitorId,
|
||||||
|
deleteNotificationsByMonitorId,
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user