import { Controller , Get , Query , Headers , UseGuards , ParseIntPipe } from '@nestjs/common' ; import { ArticleService } from '../service/article.service' ; import { Auth } from '../../../common/interface/Auth' ; import { AdminGuard } from '../../../common/guards/admin.guard' ; @ Controller ( 'article/admin' ) @ UseGuards ( AdminGuard ) export class AdminController { constructor ( private readonly articleService ) { } @ Get ( 'detail' ) getArticle ( @ Query ( 'title' ) title , @ Query ( 'article_id' ) articleId , @ Headers ( 'auth' ) auth ) { const userId = 0 ; return this . articleService . getArticle ( userId , articleId , title ) ; } @ Get ( 'list' ) getList ( @ Query ( 'page' , new ParseIntPipe ( ) ) page , @ Query ( 'size' , new ParseIntPipe ( ) ) size , @ Headers ( 'auth' ) auth , @ Query ( 'category_id' ) categoryId ? , @ Query ( 'secret' ) secret ? , @ Query ( 'tag_id' ) tagId ? , @ Headers ( 'order' ) order ? ) { const userId = 0 ; return this . articleService . getList ( page , size , userId , secret , categoryId , tagId , order ) ; } }