feat: add ticket comment endpoints to controller
This commit is contained in:
@@ -12,6 +12,7 @@ import { AuthGuard } from '@nestjs/passport';
|
|||||||
import { TicketService } from './ticket.service';
|
import { TicketService } from './ticket.service';
|
||||||
import { CreateTicketDto } from './dto/create-ticket.dto';
|
import { CreateTicketDto } from './dto/create-ticket.dto';
|
||||||
import { UpdateTicketDto } from './dto/update-ticket.dto';
|
import { UpdateTicketDto } from './dto/update-ticket.dto';
|
||||||
|
import { CreateCommentDto } from './dto/create-comment.dto';
|
||||||
import { Roles } from '../common/decorators/roles.decorator';
|
import { Roles } from '../common/decorators/roles.decorator';
|
||||||
import { RolesGuard } from '../common/guards/roles.guard';
|
import { RolesGuard } from '../common/guards/roles.guard';
|
||||||
import { TenantGuard } from '../common/guards/tenant.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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user