From 91ea365cf90a4d705e3bbc5d115d479b7eb49f68 Mon Sep 17 00:00:00 2001 From: kevin-asprec Date: Wed, 6 May 2026 03:56:13 +0800 Subject: [PATCH] feat: add ticket comment endpoints to controller --- src/ticket/ticket.controller.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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); + } }