import { Controller , Get , Param , Query , UseGuards } from '@nestjs/common' ; import { CommentService , UserService } from '../../../service' ; import { JwtAuthGuard } from '../../middleware/guards/auth.guard' ; @ Controller ( 'comments' ) @ UseGuards ( JwtAuthGuard ) export class CommentController { constructor ( private readonly userService , private readonly commentService ) { } param page param limit @ Get ( ) async index ( @ Query ( 'page' ) page = 0 , @ Query ( 'limit' ) limit = 10 ) { limit = limit > 100 ? 100 : limit ; const data = await this . commentService . paginate ( { page , limit , route : 'posts' , } ) ; return data ; } param id @ Get ( ':id' ) async one ( @ Param ( 'id' ) id ) { const data = await this . commentService . findById ( id ) ; return data ; } }