- Shares: ShareEnvelopeDto, ShareMarketDataEnvelopeDto, DividendsEnvelopeDto, ShareHistoryEnvelopeDto, DividendItemDto, HistoryItemDto - Bonds: BondEnvelopeDto, BondMarketDataEnvelopeDto, BondHistoryEnvelopeDto, BondHistoryItemDto - Candles: CandleItemDto, CandleEnvelopeDto - Securities: SearchResultItemDto, SearchEnvelopeDto - Health: HealthResponseDto, HealthEnvelopeDto - Add @ApiOkResponse decorators to all previously undocumented endpoints - Reuse ApiResponseMeta from common for all envelope DTOs
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { Controller, Get, Param, Query } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiOkResponse, ApiExtraModels } from '@nestjs/swagger';
|
|
import { ApiResponseMeta } from '../../common/dto/api-response.dto';
|
|
import { BondsService } from './bonds.service';
|
|
import { BondEnvelopeDto, BondMarketDataEnvelopeDto, BondHistoryEnvelopeDto } from './dto/bonds-envelope.dto';
|
|
|
|
@ApiTags('Bonds')
|
|
@ApiExtraModels(ApiResponseMeta)
|
|
@Controller('securities/bonds')
|
|
export class BondsController {
|
|
constructor(private readonly bondsService: BondsService) {}
|
|
|
|
@Get(':secid')
|
|
@ApiOperation({ summary: 'Получить спецификацию облигации' })
|
|
@ApiOkResponse({ type: BondEnvelopeDto })
|
|
async getBond(@Param('secid') secid: string) {
|
|
return this.bondsService.getBond(secid);
|
|
}
|
|
|
|
@Get(':secid/marketdata')
|
|
@ApiOperation({ summary: 'Получить рыночные данные облигации' })
|
|
@ApiOkResponse({ type: BondMarketDataEnvelopeDto })
|
|
async getMarketData(@Param('secid') secid: string) {
|
|
return this.bondsService.getMarketData(secid);
|
|
}
|
|
|
|
@Get(':secid/history')
|
|
@ApiOperation({ summary: 'Получить дневную историю торгов облигации' })
|
|
@ApiOkResponse({ type: BondHistoryEnvelopeDto })
|
|
async getHistory(
|
|
@Param('secid') secid: string,
|
|
@Query('from') from: string,
|
|
@Query('till') till: string,
|
|
) {
|
|
return this.bondsService.getHistory(secid, from, till);
|
|
}
|
|
}
|