feat: add chatbot conversations endpoint
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Post,
|
||||
@@ -13,6 +14,7 @@ import { ActiveUser } from '@/common/decorators/active-user.decorator';
|
||||
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';
|
||||
|
||||
@Controller('chatbot')
|
||||
@Throttle({ default: { limit: 30, ttl: 60_000 } })
|
||||
@@ -24,6 +26,18 @@ export class ChatbotController {
|
||||
private readonly chatbotService: ChatbotService,
|
||||
) {}
|
||||
|
||||
@Get('conversations')
|
||||
@ApiAppResponse([
|
||||
{
|
||||
status: HttpStatus.OK,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
variants: [{ model: GetConversationDTO, isArray: true }],
|
||||
},
|
||||
])
|
||||
public async getConversations(@ActiveUser() user: User) {
|
||||
return this.chatbotService.getConversations(user);
|
||||
}
|
||||
|
||||
@Post('chat')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiAppResponse([
|
||||
|
||||
Reference in New Issue
Block a user