From 7e7188bbd7b77147c5a344db1cdca40695e1c80c Mon Sep 17 00:00:00 2001 From: anjdydhody Date: Thu, 21 Nov 2024 16:32:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20api=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/asset/asset.controller.ts | 2 ++ BE/src/auth/auth.controller.ts | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BE/src/asset/asset.controller.ts b/BE/src/asset/asset.controller.ts index 9596027c..360b85f4 100644 --- a/BE/src/asset/asset.controller.ts +++ b/BE/src/asset/asset.controller.ts @@ -26,6 +26,7 @@ export class AssetController { @ApiResponse({ status: 200, description: '매도 가능 주식 개수 조회 성공', + example: { quantity: 0 }, }) async getUserStockByCode( @Req() request: Request, @@ -48,6 +49,7 @@ export class AssetController { @ApiResponse({ status: 200, description: '매수 가능 금액 조회 성공', + example: { cash_balance: 0 }, }) async getCashBalance(@Req() request: Request) { return this.assetService.getCashBalance(parseInt(request.user.userId, 10)); diff --git a/BE/src/auth/auth.controller.ts b/BE/src/auth/auth.controller.ts index bf462d29..7e58a4bb 100644 --- a/BE/src/auth/auth.controller.ts +++ b/BE/src/auth/auth.controller.ts @@ -10,7 +10,7 @@ import { UnauthorizedException, } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; -import { ApiOperation } from '@nestjs/swagger'; +import { ApiOperation, ApiResponse } from '@nestjs/swagger'; import { Request, Response } from 'express'; import { ConfigService } from '@nestjs/config'; import { AuthService } from './auth.service'; @@ -84,6 +84,11 @@ export class AuthController { @ApiOperation({ summary: '로그인 상태 확인 API' }) @Get('/check') @UseGuards(AuthGuard('jwt')) + @ApiResponse({ + status: 200, + description: '로그인 상태 조회 성공', + example: { isLogin: true }, + }) check() { return { isLogin: true }; } From 0ff18f91b028716498bd4e407c967c41854410ca Mon Sep 17 00:00:00 2001 From: anjdydhody Date: Thu, 21 Nov 2024 16:38:37 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20api=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EB=82=98=EB=A8=B8=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/auth/dto/profile-response.dto.ts | 5 +++++ BE/src/stock/list/stock-list.controller.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/BE/src/auth/dto/profile-response.dto.ts b/BE/src/auth/dto/profile-response.dto.ts index e134876d..5363aaa8 100644 --- a/BE/src/auth/dto/profile-response.dto.ts +++ b/BE/src/auth/dto/profile-response.dto.ts @@ -1,9 +1,14 @@ +import { ApiProperty } from '@nestjs/swagger'; + export class ProfileResponseDto { constructor(name, email) { this.name = name; this.email = email; } + @ApiProperty({ description: '사용자 이름' }) name: string; + + @ApiProperty({ description: '사용자 이메일' }) email: string; } diff --git a/BE/src/stock/list/stock-list.controller.ts b/BE/src/stock/list/stock-list.controller.ts index 4db69192..e0ebb13c 100644 --- a/BE/src/stock/list/stock-list.controller.ts +++ b/BE/src/stock/list/stock-list.controller.ts @@ -22,6 +22,11 @@ export class StockListController { description: '모든 주식 종목 리스트를 조회한다.', }) @Get() + @ApiResponse({ + status: 200, + description: '주식 종목 리스트 조회 성공', + type: [StockListResponseDto], + }) async findAll(): Promise { return this.stockListService.findAll(); }