feat: Allow both users and agents to initiate conversations and dynamically display the other party based on the caller's role, while also enhancing user profile data in connection requests.

This commit is contained in:
pradeepkumar
2026-03-15 00:28:14 +05:30
parent 2c0d0f0aeb
commit 960cdd8d48
4 changed files with 120 additions and 89 deletions

View File

@@ -70,7 +70,7 @@ export class MessagesController {
// ==========================================
@Post('conversations')
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: 'Start or get existing conversation with an agent' })
@ApiOperation({ summary: 'Start or get existing conversation with a user or agent' })
@ApiResponse({
status: 200,
description: 'Conversation created or retrieved',
@@ -80,10 +80,11 @@ export class MessagesController {
description: 'Connection not accepted',
})
async startConversation(
@CurrentUser('id') userId: string,
@CurrentUser('id') callerUserId: string,
@CurrentUser('role') role: UserRole,
@Body() dto: StartConversationDto,
) {
return this.messagesService.getOrCreateConversation(userId, dto.agentProfileId);
return this.messagesService.getOrCreateConversation(callerUserId, role, dto);
}
// ==========================================