feat: add get chatbot conversation by id endpoint
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
||||
Get,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Post,
|
||||
Res,
|
||||
} from '@nestjs/common';
|
||||
@@ -15,6 +17,7 @@ import { User } from '../users/entities/user.entity';
|
||||
import { ApiAppResponse } from '@/common/decorators/api-app-response.decorator';
|
||||
import { Throttle } from '@nestjs/throttler';
|
||||
import { GetConversationDTO } from './dtos/get-conversation.dto';
|
||||
import { GetConversationDetailsDTO } from './dtos/get-conversation-details.dto';
|
||||
|
||||
@Controller('chatbot')
|
||||
@Throttle({ default: { limit: 30, ttl: 60_000 } })
|
||||
@@ -38,6 +41,21 @@ export class ChatbotController {
|
||||
return this.chatbotService.getConversations(user);
|
||||
}
|
||||
|
||||
@Get('conversations/:conversationId')
|
||||
@ApiAppResponse([
|
||||
{
|
||||
status: HttpStatus.OK,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
variants: [{ model: GetConversationDetailsDTO }],
|
||||
},
|
||||
])
|
||||
public async getConversation(
|
||||
@Param('conversationId', ParseIntPipe) conversationId: number,
|
||||
@ActiveUser() user: User,
|
||||
) {
|
||||
return this.chatbotService.getConversation(user, conversationId);
|
||||
}
|
||||
|
||||
@Post('chat')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiAppResponse([
|
||||
|
||||
Reference in New Issue
Block a user