moex-vibe/apps/backend/src/modules/portfolio/dto/portfolio-response.dto.ts

23 lines
795 B
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PortfolioSummaryDto } from './analytics-response.dto';
import { PositionWithPriceDto } from './position-with-price.dto';
export class PortfolioResponseDto {
@ApiProperty() id!: number;
@ApiProperty() name!: string;
@ApiPropertyOptional({ type: String, nullable: true }) description!: string | null;
@ApiProperty({ default: 'RUB' }) currency!: string;
@ApiProperty() createdAt!: string;
@ApiProperty() updatedAt!: string;
}
export class PortfolioDetailResponseDto extends PortfolioResponseDto {
@ApiProperty({ type: [PositionWithPriceDto] })
positions!: PositionWithPriceDto[];
@ApiProperty() totalValue!: number;
@ApiProperty({ type: PortfolioSummaryDto })
analytics!: PortfolioSummaryDto;
}