mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
12 changed files with 67 additions and 69 deletions
@ -0,0 +1,13 @@ |
|||
import { IsAfter1970Constraint } from '@ghostfolio/common/validator-constraints/is-after-1970'; |
|||
|
|||
import { IsISO8601, IsNumber, Min, Validate } from 'class-validator'; |
|||
|
|||
export class MarketDataDto { |
|||
@IsISO8601({ strict: true, strictSeparator: true }) |
|||
@Validate(IsAfter1970Constraint) |
|||
date: string; |
|||
|
|||
@IsNumber() |
|||
@Min(0) |
|||
marketPrice: number; |
|||
} |
|||
@ -1,11 +1,12 @@ |
|||
import { UpdateMarketDataDto } from '@ghostfolio/common/dtos'; |
|||
import { MarketDataDto } from '@ghostfolio/common/dtos'; |
|||
|
|||
import { Type } from 'class-transformer'; |
|||
import { ArrayNotEmpty, IsArray } from 'class-validator'; |
|||
import { ArrayNotEmpty, IsArray, ValidateNested } from 'class-validator'; |
|||
|
|||
export class UpdateBulkMarketDataDto { |
|||
@ArrayNotEmpty() |
|||
@IsArray() |
|||
@Type(() => UpdateMarketDataDto) |
|||
marketData: UpdateMarketDataDto[]; |
|||
@Type(() => MarketDataDto) |
|||
@ValidateNested({ each: true }) |
|||
marketData: MarketDataDto[]; |
|||
} |
|||
|
|||
@ -1,10 +0,0 @@ |
|||
import { IsISO8601, IsNumber, IsOptional } from 'class-validator'; |
|||
|
|||
export class UpdateMarketDataDto { |
|||
@IsISO8601() |
|||
@IsOptional() |
|||
date?: string; |
|||
|
|||
@IsNumber() |
|||
marketPrice: number; |
|||
} |
|||
@ -1,4 +0,0 @@ |
|||
export interface MarketData { |
|||
date: string; |
|||
marketPrice: number; |
|||
} |
|||
Loading…
Reference in new issue