fix aith for notification controller

This commit is contained in:
Alex Holliday committed 2025-07-21 14:11:09 -07:00
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;