diff --git a/src/ticket/ticket.controller.ts b/src/ticket/ticket.controller.ts index db6098a..792d169 100644 --- a/src/ticket/ticket.controller.ts +++ b/src/ticket/ticket.controller.ts @@ -12,6 +12,7 @@ import { AuthGuard } from '@nestjs/passport'; import { TicketService } from './ticket.service'; import { CreateTicketDto } from './dto/create-ticket.dto'; import { UpdateTicketDto } from './dto/update-ticket.dto'; +import { CreateCommentDto } from './dto/create-comment.dto'; import { Roles } from '../common/decorators/roles.decorator'; import { RolesGuard } from '../common/guards/roles.guard'; import { TenantGuard } from '../common/guards/tenant.guard'; @@ -70,4 +71,23 @@ export class TicketController { ) { return this.ticketService.resolve(user.tenantId, id, user.sub, body); } + + @Get(':id/comments') + @Roles('technician', 'collector') + async getComments( + @CurrentUser() user: CurrentUserPayload, + @Param('id') id: string, + ) { + return this.ticketService.getComments(user.tenantId, id); + } + + @Post(':id/comments') + @Roles('technician', 'collector') + async addComment( + @CurrentUser() user: CurrentUserPayload, + @Param('id') id: string, + @Body() dto: CreateCommentDto, + ) { + return this.ticketService.addComment(user.tenantId, id, user.sub, dto); + } }