Skip to content

Commit edfa3cc

Browse files
Chore: 스웨거 수정
1 parent 458b266 commit edfa3cc

2 files changed

Lines changed: 92 additions & 1 deletion

File tree

src/cardset/infrastructure/http/card.controller.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ 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';
1118
import { CardUseCase } from '../../application/card.use-case';
1219
import { CreateCardRequest } from '../../application/dto/request/create-card.request';
1320
import { UpdateCardRequest } from '../../application/dto/request/update-card.request';
@@ -16,11 +23,19 @@ import { CardCreateResponse } from '../../application/dto/response/card-create.r
1623
import { CardResponse } from '../../application/dto/response/card.response';
1724
import { ApiResponse } from '../../../shared/common/api-response';
1825

26+
@ApiTags('cards')
27+
@ApiHeader({ name: 'X-USER-ID', required: true, description: '유저 ID' })
1928
@Controller('cards')
2029
export class CardController {
2130
constructor(private readonly cardUseCase: CardUseCase) {}
2231

2332
@Post()
33+
@ApiOperation({ summary: '카드 생성' })
34+
@SwaggerApiResponse({
35+
status: 201,
36+
description: '생성 성공',
37+
type: CardCreateResponse,
38+
})
2439
async create(
2540
@Headers('X-USER-ID') _userId: string,
2641
@Body() dto: CreateCardRequest,
@@ -30,6 +45,13 @@ export class CardController {
3045
}
3146

3247
@Get('cardset/:cardsetId')
48+
@ApiOperation({ summary: '카드셋의 카드 목록 조회' })
49+
@ApiParam({ name: 'cardsetId', type: Number })
50+
@SwaggerApiResponse({
51+
status: 200,
52+
description: '조회 성공',
53+
type: [CardResponse],
54+
})
3355
async findByCardsetId(
3456
@Headers('X-USER-ID') _userId: string,
3557
@Param('cardsetId') cardsetId: string,
@@ -41,6 +63,13 @@ export class CardController {
4163
}
4264

4365
@Get(':cardId')
66+
@ApiOperation({ summary: '카드 단건 조회' })
67+
@ApiParam({ name: 'cardId', type: Number })
68+
@SwaggerApiResponse({
69+
status: 200,
70+
description: '조회 성공',
71+
type: CardResponse,
72+
})
4473
async findOne(
4574
@Headers('X-USER-ID') _userId: string,
4675
@Param('cardId') cardId: string,
@@ -50,6 +79,8 @@ export class CardController {
5079
}
5180

5281
@Put('reorder')
82+
@ApiOperation({ summary: '카드 순서 변경' })
83+
@SwaggerApiResponse({ status: 200, description: '순서 변경 성공' })
5384
async reorderCards(
5485
@Headers('X-USER-ID') _userId: string,
5586
@Body() dto: ReorderCardsRequest,
@@ -59,6 +90,13 @@ export class CardController {
5990
}
6091

6192
@Put(':cardId')
93+
@ApiOperation({ summary: '카드 수정' })
94+
@ApiParam({ name: 'cardId', type: Number })
95+
@SwaggerApiResponse({
96+
status: 200,
97+
description: '수정 성공',
98+
type: CardResponse,
99+
})
62100
async update(
63101
@Headers('X-USER-ID') _userId: string,
64102
@Param('cardId') cardId: string,
@@ -69,6 +107,9 @@ export class CardController {
69107
}
70108

71109
@Delete(':cardId')
110+
@ApiOperation({ summary: '카드 삭제' })
111+
@ApiParam({ name: 'cardId', type: Number })
112+
@SwaggerApiResponse({ status: 200, description: '삭제 성공' })
72113
async remove(
73114
@Headers('X-USER-ID') _userId: string,
74115
@Param('cardId') cardId: string,

src/cardset/infrastructure/http/cardset.controller.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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';
1118
import { CardsetUseCase } from '../../application/cardset.use-case';
1219
import { CreateCardsetRequest } from '../../application/dto/request/create-cardset.request';
1320
import { UpdateCardsetRequest } from '../../application/dto/request/update-cardset.request';
1421
import { CardsetCreateResponse } from '../../application/dto/response/cardset-create.response';
1522
import { CardsetResponse } from '../../application/dto/response/cardset.response';
1623
import { 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')
1928
export 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

Comments
 (0)