import { Controller , Get , Query , ParseIntPipe } from '@nestjs/common' ; import { ArticleService } from '../service/article.service' ; import { UN_SECRET_STATUS } from '../constance' ; @ Controller ( 'article/visitor' ) export class VisitorController { constructor ( private readonly articleService ) { } @ Get ( 'list' ) getList ( @ Query ( 'page' , new ParseIntPipe ( ) ) page , @ Query ( 'size' , new ParseIntPipe ( ) ) size , @ Query ( 'user_id' , new ParseIntPipe ( ) ) userId , @ Query ( 'category_id' ) categoryId ? , @ Query ( 'tag_id' ) tagId ? , @ Query ( 'order' ) order ? ) { const secret = UN_SECRET_STATUS ; return this . articleService . getList ( page , size , userId , secret , categoryId , tagId , order ) ; } @ Get ( 'detail' ) getArticle ( @ Query ( 'title' ) title , @ Query ( 'article_id' ) articleId , @ Query ( 'user_id' , new ParseIntPipe ( ) ) userId ) { const secret = UN_SECRET_STATUS ; return this . articleService . getArticle ( userId , articleId , title , secret ) ; } }