feat: mark related message notifications as read when updating conversation unread count

This commit is contained in:
pradeepkumar committed 2026-04-13 22:48:05 +05:30
1 parent 02a1f15324
commit d84e55cb61
1 file changed
+15
+15
View File
@@ -562,6 +562,21 @@ export class MessagesService {
data: isUser ? { userUnreadCount: 0 } : { agentUnreadCount: 0 },
});
// Also mark related message notifications as read for this user
// Notifications store conversationId in the JSON `data` field
await this.prisma.notification.updateMany({
where: {
userId,
type: 'message',
read: false,
data: {
path: ['conversationId'],
equals: conversationId,
},
},
data: { read: true },
});
return { success: true };
}