From f8c7046982da61436b7cd325de18f36a7e81c46e Mon Sep 17 00:00:00 2001 From: JIN Date: Wed, 6 Nov 2024 17:10:16 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=98=A4=EB=8A=98=EC=9D=98?= =?UTF-8?q?=20=EC=83=81/=ED=95=98=EC=9C=84=20=EC=A2=85=EB=AA=A9=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20API=20Controller=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84#12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/stocks/topfive/topfive.controller.ts | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 BE/src/stocks/topfive/topfive.controller.ts diff --git a/BE/src/stocks/topfive/topfive.controller.ts b/BE/src/stocks/topfive/topfive.controller.ts new file mode 100644 index 00000000..9dcf2715 --- /dev/null +++ b/BE/src/stocks/topfive/topfive.controller.ts @@ -0,0 +1,28 @@ +import { ApiOperation, ApiQuery, ApiResponse } from '@nestjs/swagger'; +import { Controller, Get, Query } from '@nestjs/common'; +import { TopFiveService, MarketType } from './topfive.service'; +import { StockRankingResponseDto } from './dto/stock-ranking-response.dto'; + +@Controller('/api/stocks') +export class TopfiveController { + constructor(private readonly topFiveService: TopFiveService) {} + + @Get('topfive') + @ApiOperation({ summary: '오늘의 상/하위 종목 조회 API' }) + @ApiQuery({ + name: 'market', + enum: MarketType, + required: true, + description: + '주식 시장 구분\n' + + 'ALL: 전체, KOSPI: 코스피, KOSDAQ: 코스닥, KOSPI200: 코스피200', + }) + @ApiResponse({ + status: 200, + description: '주식 시장별 순위 조회 성공', + type: StockRankingResponseDto, + }) + async getTopFive(@Query('market') market: MarketType) { + return this.topFiveService.getMarketRanking(market); + } +}