Enable strict TypeScript and reject non-null and definite-assignment assertions. Declare externally populated DTO fields, preserve runtime validation, and narrow values at their owners. Verified: backend verify (257 tests), unchanged OpenAPI, and 21 SQLite/HTTP tests on retry. The initial SQLite run had two timeouts; baseline HEAD passed 21 tests as well.
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { MoneyDto } from '../common/money.dto';
|
|
|
|
export class PortfolioSummaryDto {
|
|
@ApiProperty({ type: MoneyDto, isArray: true })
|
|
declare totalsByCurrency: MoneyDto[];
|
|
|
|
@ApiProperty({
|
|
type: 'integer',
|
|
minimum: 0,
|
|
description: 'Number of non-zero stock positions, not the number of units.',
|
|
})
|
|
declare stockPositionCount: number;
|
|
|
|
@ApiProperty({
|
|
type: 'integer',
|
|
minimum: 0,
|
|
description: 'Number of non-zero bond positions, not the number of units.',
|
|
})
|
|
declare bondPositionCount: number;
|
|
}
|
|
|
|
export class BrokerageAccountDto {
|
|
@ApiProperty()
|
|
declare id: string;
|
|
|
|
@ApiProperty()
|
|
declare name: string;
|
|
|
|
@ApiProperty({
|
|
enum: [
|
|
'BROKERAGE',
|
|
'INDIVIDUAL_INVESTMENT',
|
|
'INVEST_BOX',
|
|
'MONEY_MARKET_FUND',
|
|
],
|
|
})
|
|
declare type:
|
|
'BROKERAGE' | 'INDIVIDUAL_INVESTMENT' | 'INVEST_BOX' | 'MONEY_MARKET_FUND';
|
|
|
|
@ApiProperty({ type: String, nullable: true, format: 'date' })
|
|
declare openedOn: string | null;
|
|
|
|
@ApiProperty({ type: PortfolioSummaryDto, nullable: true })
|
|
portfolioSummary?: PortfolioSummaryDto | null;
|
|
}
|