You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
646 B

import { IsNumber, IsString, Max, Min, ValidateIf } from 'class-validator';
/**
* Accepts the allocation as weight (format of the asset profile) or as
* allocationInPercentage (format of the export), at least one is required
*/
export class HoldingDto {
@IsNumber()
@Max(1)
@Min(0)
@ValidateIf(({ weight }, value) => {
return value !== undefined || weight === undefined;
})
allocationInPercentage?: number;
@IsString()
name: string;
@IsNumber()
@Max(1)
@Min(0)
@ValidateIf(({ allocationInPercentage }, value) => {
return value !== undefined || allocationInPercentage === undefined;
})
weight?: number;
}