Files
canina/backend/src/support-chat/support-chat.controller.ts
T
devops 1f68210d08
Deploy Canina / deploy (push) Successful in 1m50s
fix(support-chat): import UUID route validator
2026-10-15 18:35:37 +00:00

14 lines
944 B
TypeScript

import { Body, Controller, Get, Header, Param, ParseUUIDPipe, Post, Req, UseGuards } from '@nestjs/common';
import { Throttle } from '@nestjs/throttler';
import { SupportChatService } from './support-chat.service';
import { SupportChatDto } from './support-chat.dto';
import { OptionalCustomerJwtGuard } from './support-chat.guard';
@Controller('support-chat')
export class SupportChatController {
constructor(private readonly service: SupportChatService) {}
@Get(':id') @UseGuards(OptionalCustomerJwtGuard) @Header('Cache-Control', 'no-store')
history(@Param('id', ParseUUIDPipe) id: string, @Req() req: { user?: { id: string } }) { return this.service.history(id, req.user); }
@Post('ask') @UseGuards(OptionalCustomerJwtGuard) @Throttle({ default: { limit: 10, ttl: 60000 } }) @Header('Cache-Control', 'no-store')
ask(@Body() dto: SupportChatDto, @Req() req: { user?: { id: string } }) { return this.service.ask(dto, req.user); }
}