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); + } +}