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:
@@ -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);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user