@@ -66,7 +66,7 @@ const markNotificationAsRead = async (req, res) => {
6666 return res . status ( 400 ) . json ( { message : 'User ID is required' } ) ;
6767 }
6868 // Check if the global notification exists
69- const notificationExists = await Notification . exists ( { _id : id } ) ;
69+ const notificationExists = await Notification . exists ( { _id : { $eq : id } } ) ;
7070 if ( ! notificationExists ) {
7171 return res . status ( 404 ) . json ( { message : 'Global notification not found' } ) ;
7272 }
@@ -79,7 +79,7 @@ const markNotificationAsRead = async (req, res) => {
7979 ) ;
8080 } else {
8181 // Update read status for user-specific notifications
82- await UserNotification . findOneAndUpdate ( { _id : id } , { read : true } ) ;
82+ await UserNotification . findOneAndUpdate ( { _id : { $eq : id } } , { read : true } ) ;
8383 }
8484
8585 return res . status ( 200 ) . json ( { message : 'Notification marked as read' } ) ;
@@ -111,7 +111,7 @@ const markNotificationAsDeleted = async (req, res) => {
111111 return res . status ( 400 ) . json ( { message : 'User ID is required' } ) ;
112112 }
113113 // Check if the global notification exists
114- const notificationExists = await Notification . exists ( { _id : id } ) ;
114+ const notificationExists = await Notification . exists ( { _id : { $eq : id } } ) ;
115115 if ( ! notificationExists ) {
116116 return res . status ( 404 ) . json ( { message : 'Global notification not found' } ) ;
117117 }
@@ -124,7 +124,7 @@ const markNotificationAsDeleted = async (req, res) => {
124124 ) ;
125125 } else {
126126 // Update deleted status for user-specific notifications
127- await UserNotification . findOneAndUpdate ( { _id : id } , { deleted : true } ) ;
127+ await UserNotification . findOneAndUpdate ( { _id : { $eq : id } } , { deleted : true } ) ;
128128 }
129129
130130 return res . status ( 200 ) . json ( { message : 'Notification marked as deleted' } ) ;
0 commit comments