@@ -7,28 +7,27 @@ import { CommentsRO } from './article.interface';
77import { User } from '../user/user.decorator' ;
88
99import {
10- ApiUseTags ,
1110 ApiBearerAuth ,
1211 ApiResponse ,
13- ApiOperation ,
12+ ApiOperation , ApiTags ,
1413} from '@nestjs/swagger' ;
1514
1615@ApiBearerAuth ( )
17- @ApiUseTags ( 'articles' )
16+ @ApiTags ( 'articles' )
1817@Controller ( 'articles' )
1918export class ArticleController {
2019
2120 constructor ( private readonly articleService : ArticleService ) { }
2221
23- @ApiOperation ( { title : 'Get all articles' } )
22+ @ApiOperation ( { summary : 'Get all articles' } )
2423 @ApiResponse ( { status : 200 , description : 'Return all articles.' } )
2524 @Get ( )
2625 async findAll ( @Query ( ) query ) : Promise < ArticlesRO > {
2726 return await this . articleService . findAll ( query ) ;
2827 }
2928
3029
31- @ApiOperation ( { title : 'Get article feed' } )
30+ @ApiOperation ( { summary : 'Get article feed' } )
3231 @ApiResponse ( { status : 200 , description : 'Return article feed.' } )
3332 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
3433 @Get ( 'feed' )
@@ -46,15 +45,15 @@ export class ArticleController {
4645 return await this . articleService . findComments ( slug ) ;
4746 }
4847
49- @ApiOperation ( { title : 'Create article' } )
48+ @ApiOperation ( { summary : 'Create article' } )
5049 @ApiResponse ( { status : 201 , description : 'The article has been successfully created.' } )
5150 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
5251 @Post ( )
5352 async create ( @User ( 'id' ) userId : number , @Body ( 'article' ) articleData : CreateArticleDto ) {
5453 return this . articleService . create ( userId , articleData ) ;
5554 }
5655
57- @ApiOperation ( { title : 'Update article' } )
56+ @ApiOperation ( { summary : 'Update article' } )
5857 @ApiResponse ( { status : 201 , description : 'The article has been successfully updated.' } )
5958 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
6059 @Put ( ':slug' )
@@ -63,23 +62,23 @@ export class ArticleController {
6362 return this . articleService . update ( params . slug , articleData ) ;
6463 }
6564
66- @ApiOperation ( { title : 'Delete article' } )
65+ @ApiOperation ( { summary : 'Delete article' } )
6766 @ApiResponse ( { status : 201 , description : 'The article has been successfully deleted.' } )
6867 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
6968 @Delete ( ':slug' )
7069 async delete ( @Param ( ) params ) {
7170 return this . articleService . delete ( params . slug ) ;
7271 }
7372
74- @ApiOperation ( { title : 'Create comment' } )
73+ @ApiOperation ( { summary : 'Create comment' } )
7574 @ApiResponse ( { status : 201 , description : 'The comment has been successfully created.' } )
7675 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
7776 @Post ( ':slug/comments' )
7877 async createComment ( @Param ( 'slug' ) slug , @Body ( 'comment' ) commentData : CreateCommentDto ) {
7978 return await this . articleService . addComment ( slug , commentData ) ;
8079 }
8180
82- @ApiOperation ( { title : 'Delete comment' } )
81+ @ApiOperation ( { summary : 'Delete comment' } )
8382 @ApiResponse ( { status : 201 , description : 'The article has been successfully deleted.' } )
8483 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
8584 @Delete ( ':slug/comments/:id' )
@@ -88,15 +87,15 @@ export class ArticleController {
8887 return await this . articleService . deleteComment ( slug , id ) ;
8988 }
9089
91- @ApiOperation ( { title : 'Favorite article' } )
90+ @ApiOperation ( { summary : 'Favorite article' } )
9291 @ApiResponse ( { status : 201 , description : 'The article has been successfully favorited.' } )
9392 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
9493 @Post ( ':slug/favorite' )
9594 async favorite ( @User ( 'id' ) userId : number , @Param ( 'slug' ) slug ) {
9695 return await this . articleService . favorite ( userId , slug ) ;
9796 }
9897
99- @ApiOperation ( { title : 'Unfavorite article' } )
98+ @ApiOperation ( { summary : 'Unfavorite article' } )
10099 @ApiResponse ( { status : 201 , description : 'The article has been successfully unfavorited.' } )
101100 @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
102101 @Delete ( ':slug/favorite' )
0 commit comments