mirror of https://github.com/ghostfolio/ghostfolio
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.
72 lines
1.1 KiB
72 lines
1.1 KiB
import {
|
|
AssetClass,
|
|
AssetSubClass,
|
|
DataSource,
|
|
Tag,
|
|
Type
|
|
} from '@prisma/client';
|
|
import { Transform, TransformFnParams } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsBoolean,
|
|
IsEnum,
|
|
IsISO8601,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString
|
|
} from 'class-validator';
|
|
import { isString } from 'lodash';
|
|
|
|
export class CreateOrderDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
accountId?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(AssetClass, { each: true })
|
|
assetClass?: AssetClass;
|
|
|
|
@IsOptional()
|
|
@IsEnum(AssetSubClass, { each: true })
|
|
assetSubClass?: AssetSubClass;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@Transform(({ value }: TransformFnParams) =>
|
|
isString(value) ? value.trim() : value
|
|
)
|
|
comment?: string;
|
|
|
|
@IsString()
|
|
currency: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(DataSource, { each: true })
|
|
dataSource?: DataSource;
|
|
|
|
@IsISO8601()
|
|
date: string;
|
|
|
|
@IsNumber()
|
|
fee: number;
|
|
|
|
@IsNumber()
|
|
quantity: number;
|
|
|
|
@IsString()
|
|
symbol: string;
|
|
|
|
@IsArray()
|
|
@IsOptional()
|
|
tags?: Tag[];
|
|
|
|
@IsEnum(Type, { each: true })
|
|
type: Type;
|
|
|
|
@IsNumber()
|
|
unitPrice: number;
|
|
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
updateAccountBalance?: boolean;
|
|
}
|
|
|