fix aith for notification controller
This commit is contained in:
1 parent
78b371bfad
commit
1b085236c7
3 files changed
+77
-14
No files matched your search
@@ -74,6 +74,11 @@ const deleteNotificationsByMonitorId = async (monitorId) => {
|
||||
|
||||
const deleteNotificationById = async (id) => {
|
||||
try {
|
||||
const notification = await Notification.findById(id);
|
||||
if (!notification) {
|
||||
throw new Error("Notification not found");
|
||||
}
|
||||
|
||||
const result = await Notification.findByIdAndDelete(id);
|
||||
await Monitor.updateMany({ notifications: id }, { $pull: { notifications: id } });
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user