mirror of https://github.com/ghostfolio/ghostfolio
10 changed files with 40 additions and 67 deletions
@ -1,9 +1,13 @@ |
|||||
import { IsISO8601, IsNumber } from 'class-validator'; |
import { IsAfter1970Constraint } from '@ghostfolio/common/validator-constraints/is-after-1970'; |
||||
|
|
||||
|
import { IsISO8601, IsNumber, Min, Validate } from 'class-validator'; |
||||
|
|
||||
export class MarketDataDto { |
export class MarketDataDto { |
||||
@IsISO8601() |
@IsISO8601({ strict: true, strictSeparator: true }) |
||||
|
@Validate(IsAfter1970Constraint) |
||||
date: string; |
date: string; |
||||
|
|
||||
@IsNumber() |
@IsNumber() |
||||
|
@Min(0) |
||||
marketPrice: number; |
marketPrice: number; |
||||
} |
} |
||||
|
|||||
@ -1,11 +1,12 @@ |
|||||
import { UpdateMarketDataDto } from '@ghostfolio/common/dtos'; |
import { MarketDataDto } from '@ghostfolio/common/dtos'; |
||||
|
|
||||
import { Type } from 'class-transformer'; |
import { Type } from 'class-transformer'; |
||||
import { ArrayNotEmpty, IsArray } from 'class-validator'; |
import { ArrayNotEmpty, IsArray, ValidateNested } from 'class-validator'; |
||||
|
|
||||
export class UpdateBulkMarketDataDto { |
export class UpdateBulkMarketDataDto { |
||||
@ArrayNotEmpty() |
@ArrayNotEmpty() |
||||
@IsArray() |
@IsArray() |
||||
@Type(() => UpdateMarketDataDto) |
@Type(() => MarketDataDto) |
||||
marketData: UpdateMarketDataDto[]; |
@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