feat: Implement direct notification for new messages and read receipts to conversation participants.

This commit is contained in:
pradeepkumar
2026-02-11 04:48:15 +05:30
parent 6bc0b41e1f
commit 755ddda123
2 changed files with 46 additions and 3 deletions

View File

@@ -555,6 +555,28 @@ export class MessagesService {
}
}
/**
* Get participant user IDs for a conversation (lightweight query)
*/
async getConversationParticipants(conversationId: string): Promise<{ userId: string; agentUserId: string } | null> {
const conversation = await this.prisma.conversation.findUnique({
where: { id: conversationId },
select: {
userId: true,
agentProfile: {
select: { userId: true },
},
},
});
if (!conversation) return null;
return {
userId: conversation.userId,
agentUserId: conversation.agentProfile.userId,
};
}
/**
* Get total unread count for a user across all conversations
*/