Skip to content

Commit

Permalink
✨ feat: 프론트에서 필요한 값만 반환할 수 있도록 DTO 수정#54
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuo3o committed Nov 13, 2024
1 parent e7ae190 commit 5989e08
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
21 changes: 0 additions & 21 deletions BE/src/stock/detail/dto/stock-detail-chart-data.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,4 @@ export class InquirePriceChartDataDto {

@ApiProperty({ description: '누적 거래량' })
acml_vol: string;

@ApiProperty({ description: '누적 거래 대금' })
acml_tr_pbmn: string;

@ApiProperty({ description: '락 구분 코드' })
flng_cls_code: string;

@ApiProperty({ description: '분할 비율' })
prtt_rate: string;

@ApiProperty({ description: '분할변경여부' })
mod_yn: string;

@ApiProperty({ description: '전일 대비 부호' })
prdy_vrss_sign: string;

@ApiProperty({ description: '전일 대비' })
prdy_vrss: string;

@ApiProperty({ description: '재평가사유코드' })
revl_issu_reas: string;
}
24 changes: 20 additions & 4 deletions BE/src/stock/detail/stock-detail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { KoreaInvestmentService } from '../../koreaInvestment/korea-investment.s
import { getHeader } from '../../util/get-header';
import { getFullURL } from '../../util/get-full-URL';
import { InquirePriceApiResponse } from './interface/stock-detail.interface';
import { InquirePriceChartResponseDto } from './dto/stock-detail-chart-response.dto';
import { InquirePriceChartDataDto } from './dto/stock-detail-chart-data.dto';

@Injectable()
export class StockDetailService {
Expand Down Expand Up @@ -102,11 +102,27 @@ export class StockDetailService {
* @author uuuo3o
*/
private formatStockInquirePriceData(response: InquirePriceApiResponse) {
const stockData = new InquirePriceChartResponseDto();
const { output2 } = response;

stockData.output = output2;
return output2.map((info) => {
const stockData = new InquirePriceChartDataDto();
const {
stck_bsop_date,
stck_clpr,
stck_oprc,
stck_hgpr,
stck_lwpr,
acml_vol,
} = info;

return stockData;
stockData.stck_bsop_date = stck_bsop_date;
stockData.stck_clpr = stck_clpr;
stockData.stck_oprc = stck_oprc;
stockData.stck_hgpr = stck_hgpr;
stockData.stck_lwpr = stck_lwpr;
stockData.acml_vol = acml_vol;

return stockData;
});
}
}

0 comments on commit 5989e08

Please sign in to comment.