@@ -8,18 +8,34 @@ import {
88 Param ,
99 Headers ,
1010} from '@nestjs/common' ;
11+ import {
12+ ApiTags ,
13+ ApiOperation ,
14+ ApiResponse as SwaggerApiResponse ,
15+ ApiHeader ,
16+ ApiParam ,
17+ } from '@nestjs/swagger' ;
1118import { CardsetUseCase } from '../../application/cardset.use-case' ;
1219import { CreateCardsetRequest } from '../../application/dto/request/create-cardset.request' ;
1320import { UpdateCardsetRequest } from '../../application/dto/request/update-cardset.request' ;
1421import { CardsetCreateResponse } from '../../application/dto/response/cardset-create.response' ;
1522import { CardsetResponse } from '../../application/dto/response/cardset.response' ;
1623import { ApiResponse } from '../../../shared/common/api-response' ;
1724
25+ @ApiTags ( 'card-sets' )
26+ @ApiHeader ( { name : 'X-USER-ID' , required : true , description : '유저 ID' } )
1827@Controller ( 'card-sets' )
1928export class CardsetController {
20- constructor ( private readonly cardsetUseCase : CardsetUseCase ) { }
29+ constructor ( private readonly cardsetUseCase : CardsetUseCase ) { }
2130
2231 @Post ( )
32+ @ApiOperation ( { summary : '카드셋 생성' } )
33+ @SwaggerApiResponse ( {
34+ status : 201 ,
35+ description : '생성 성공' ,
36+ type : CardsetCreateResponse ,
37+ } )
38+ @SwaggerApiResponse ( { status : 403 , description : '그룹 멤버 아님' } )
2339 async create (
2440 @Headers ( 'X-USER-ID' ) userId : string ,
2541 @Body ( ) dto : CreateCardsetRequest ,
@@ -29,6 +45,12 @@ export class CardsetController {
2945 }
3046
3147 @Get ( )
48+ @ApiOperation ( { summary : '카드셋 목록 조회' } )
49+ @SwaggerApiResponse ( {
50+ status : 200 ,
51+ description : '조회 성공' ,
52+ type : [ CardsetResponse ] ,
53+ } )
3254 async findAll (
3355 @Headers ( 'X-USER-ID' ) userId : string ,
3456 ) : Promise < ApiResponse < CardsetResponse [ ] > > {
@@ -41,6 +63,14 @@ export class CardsetController {
4163 }
4264
4365 @Get ( ':cardsetId' )
66+ @ApiOperation ( { summary : '카드셋 단건 조회' } )
67+ @ApiParam ( { name : 'cardsetId' , type : Number } )
68+ @SwaggerApiResponse ( {
69+ status : 200 ,
70+ description : '조회 성공' ,
71+ type : CardsetResponse ,
72+ } )
73+ @SwaggerApiResponse ( { status : 403 , description : '접근 권한 없음' } )
4474 async findOne (
4575 @Headers ( 'X-USER-ID' ) userId : string ,
4676 @Param ( 'cardsetId' ) cardsetId : string ,
@@ -55,6 +85,14 @@ export class CardsetController {
5585 }
5686
5787 @Put ( ':cardsetId' )
88+ @ApiOperation ( { summary : '카드셋 수정' } )
89+ @ApiParam ( { name : 'cardsetId' , type : Number } )
90+ @SwaggerApiResponse ( {
91+ status : 200 ,
92+ description : '수정 성공' ,
93+ type : CardsetResponse ,
94+ } )
95+ @SwaggerApiResponse ( { status : 403 , description : '매니저 권한 없음' } )
5896 async update (
5997 @Headers ( 'X-USER-ID' ) userId : string ,
6098 @Param ( 'cardsetId' ) cardsetId : string ,
@@ -69,6 +107,10 @@ export class CardsetController {
69107 }
70108
71109 @Delete ( ':cardsetId' )
110+ @ApiOperation ( { summary : '카드셋 삭제' } )
111+ @ApiParam ( { name : 'cardsetId' , type : Number } )
112+ @SwaggerApiResponse ( { status : 200 , description : '삭제 성공' } )
113+ @SwaggerApiResponse ( { status : 403 , description : '매니저 권한 없음' } )
72114 async remove (
73115 @Headers ( 'X-USER-ID' ) userId : string ,
74116 @Param ( 'cardsetId' ) cardsetId : string ,
@@ -78,6 +120,14 @@ export class CardsetController {
78120 }
79121
80122 @Put ( ':cardsetId/card-count' )
123+ @ApiOperation ( { summary : '카드 수 업데이트' } )
124+ @ApiParam ( { name : 'cardsetId' , type : Number } )
125+ @SwaggerApiResponse ( {
126+ status : 200 ,
127+ description : '업데이트 성공' ,
128+ type : CardsetResponse ,
129+ } )
130+ @SwaggerApiResponse ( { status : 403 , description : '매니저 권한 없음' } )
81131 async updateCardCount (
82132 @Headers ( 'X-USER-ID' ) userId : string ,
83133 @Param ( 'cardsetId' ) cardsetId : string ,
0 commit comments