54 lines
924 B
TypeScript
54 lines
924 B
TypeScript
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsInt,
|
|
IsNumber,
|
|
Min,
|
|
IsArray,
|
|
IsIn,
|
|
MaxLength,
|
|
} from 'class-validator';
|
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
const TAGS = [
|
|
'DIVIDEND',
|
|
'GROWTH',
|
|
'DEFENSIVE',
|
|
'SPECULATIVE',
|
|
'BOND',
|
|
'ETF',
|
|
'GOVERNMENT',
|
|
'CASH',
|
|
] as const;
|
|
|
|
export class UpdatePositionDto {
|
|
@ApiPropertyOptional({ example: 15 })
|
|
@IsInt()
|
|
@Min(0)
|
|
@IsOptional()
|
|
quantity?: number;
|
|
|
|
@ApiPropertyOptional({ example: 260.0 })
|
|
@IsNumber()
|
|
@Min(0)
|
|
@IsOptional()
|
|
buyPrice?: number;
|
|
|
|
@ApiPropertyOptional({ example: '2026-06-15' })
|
|
@IsString()
|
|
@IsOptional()
|
|
buyDate?: string;
|
|
|
|
@ApiPropertyOptional({ example: 'Докупка' })
|
|
@IsString()
|
|
@IsOptional()
|
|
@MaxLength(500)
|
|
notes?: string;
|
|
|
|
@ApiPropertyOptional({ example: ['DIVIDEND'], enum: TAGS, isArray: true })
|
|
@IsArray()
|
|
@IsIn(TAGS, { each: true })
|
|
@IsOptional()
|
|
tags?: string[];
|
|
}
|