Skip to content

Commit 6e18e80

Browse files
authored
Merge pull request #13 from vsCode-Game/fix/user
Docs: 스웨거 authorization 추가
2 parents 9029361 + 7a87d7c commit 6e18e80

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/auth/auth.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class AuthController {
104104
summary: '프로필 조회(Protected)',
105105
description: '로그인이 필요한 프로필 조회 API',
106106
})
107-
@ApiBearerAuth() // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
107+
@ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
108108
@ApiResponse({
109109
status: 200,
110110
description: '정상적으로 접근한 경우',

src/gameRoom/gameRoom.controller.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
ApiResponse,
2121
ApiBody,
2222
ApiParam,
23+
ApiBearerAuth,
2324
} from '@nestjs/swagger';
2425

2526
// DTO import
@@ -63,6 +64,7 @@ export class GameRoomController {
6364
@UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용
6465
@Post('create')
6566
@ApiOperation({ summary: '방 생성과 동시에 참가' })
67+
@ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
6668
@ApiBody({ type: CreateGameRoomDto })
6769
@ApiResponse({
6870
status: 201,
@@ -92,6 +94,7 @@ export class GameRoomController {
9294
@UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용
9395
@Post('join/:roomId')
9496
@ApiOperation({ summary: '방 참가' })
97+
@ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
9598
@ApiParam({ name: 'roomId', type: Number, description: '참가할 게임 방 ID' })
9699
@ApiResponse({
97100
status: 201,
@@ -135,6 +138,7 @@ export class GameRoomController {
135138
@UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용
136139
@Delete('leave/:roomId')
137140
@ApiOperation({ summary: '방 나가기' })
141+
@ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
138142
@ApiParam({ name: 'roomId', type: Number, description: '나갈 게임 방 ID' })
139143
@ApiResponse({
140144
status: 200,
@@ -179,6 +183,7 @@ export class GameRoomController {
179183

180184
@Get(':roomId')
181185
@ApiOperation({ summary: '방 상태 조회' })
186+
@ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시
182187
@ApiParam({ name: 'roomId', type: Number, description: '조회할 게임 방 ID' })
183188
@ApiResponse({
184189
status: 200,

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function bootstrap() {
1515
origin: [
1616
'http://localhost:5173',
1717
'http://localhost:3000',
18-
'https://api.davincicodegame.store',
18+
'https://davincicodegame.store',
1919
],
2020
credentials: true,
2121
});
@@ -32,6 +32,7 @@ async function bootstrap() {
3232
type: 'http',
3333
scheme: 'bearer',
3434
bearerFormat: 'JWT',
35+
in: 'header',
3536
},
3637
'access-token',
3738
)

0 commit comments

Comments
 (0)