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

This commit is contained in:
pradeepkumar
2026-04-13 22:48:05 +05:30
parent 02a1f15324
commit d84e55cb61

View File

@@ -562,6 +562,21 @@ export class MessagesService {
data: isUser ? { userUnreadCount: 0 } : { agentUnreadCount: 0 }, 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 }; return { success: true };
} }