Skip to content

Commit

Permalink
πŸ“ docs : swagger λ¬Έμ„œ Parameter ν•„μˆ˜ μˆ˜μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 13, 2024
1 parent 8e690fa commit c570788
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions BE/src/stock/list/dto/stock-list-response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { ApiProperty } from '@nestjs/swagger';

export class StockListResponseDto {
@ApiProperty({ example: '005930', description: 'μ’…λͺ© μ½”λ“œ' })
@ApiProperty({ example: '005930', description: 'μ’…λͺ© μ½”λ“œ', required: false })
code: string;

@ApiProperty({ example: 'μ‚Όμ„±μ „μž', description: 'μ’…λͺ© 이름' })
@ApiProperty({
example: 'μ‚Όμ„±μ „μž',
description: 'μ’…λͺ© 이름',
required: false,
})
name: string;

@ApiProperty({ example: 'KOSPI', description: 'μ‹œμž₯' })
@ApiProperty({ example: 'KOSPI', description: 'μ‹œμž₯', required: false })
market: string;

constructor(code: string, name: string, market: string) {
Expand Down
5 changes: 4 additions & 1 deletion BE/src/stock/list/stock-list.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller, Get, Query } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiQuery, ApiResponse, ApiTags } from '@nestjs/swagger';
import { StockListService } from './stock-list.service';
import { StockListResponseDto } from './dto/stock-list-response.dto';

Expand Down Expand Up @@ -28,6 +28,9 @@ export class StockListController {
type: StockListResponseDto,
isArray: true,
})
@ApiQuery({ name: 'name', required: false })
@ApiQuery({ name: 'market', required: false })
@ApiQuery({ name: 'code', required: false })
@Get('/search')
async searchWithQuery(
@Query('name') name?: string,
Expand Down

0 comments on commit c570788

Please sign in to comment.