mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
14 changed files with 316 additions and 47 deletions
@ -0,0 +1,92 @@ |
|||
import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code'; |
|||
|
|||
import { AssetClass, AssetSubClass, DataSource, Prisma } from '@prisma/client'; |
|||
import { |
|||
IsArray, |
|||
IsBoolean, |
|||
IsEnum, |
|||
IsObject, |
|||
IsOptional, |
|||
IsString, |
|||
IsUrl |
|||
} from 'class-validator'; |
|||
|
|||
export class CreateAssetProfileDto { |
|||
@IsEnum(AssetClass, { each: true }) |
|||
@IsOptional() |
|||
assetClass?: AssetClass; |
|||
|
|||
@IsEnum(AssetSubClass, { each: true }) |
|||
@IsOptional() |
|||
assetSubClass?: AssetSubClass; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
comment?: string; |
|||
|
|||
@IsArray() |
|||
@IsOptional() |
|||
countries?: Prisma.InputJsonArray; |
|||
|
|||
@IsCurrencyCode() |
|||
currency: string; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
cusip?: string; |
|||
|
|||
@IsEnum(DataSource) |
|||
dataSource: DataSource; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
figi?: string; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
figiComposite?: string; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
figiShareClass?: string; |
|||
|
|||
@IsArray() |
|||
@IsOptional() |
|||
holdings?: Prisma.InputJsonArray; |
|||
|
|||
@IsBoolean() |
|||
@IsOptional() |
|||
isActive?: boolean; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
isin?: string; |
|||
|
|||
@IsOptional() |
|||
@IsString() |
|||
name?: string; |
|||
|
|||
@IsObject() |
|||
@IsOptional() |
|||
scraperConfiguration?: Prisma.InputJsonObject; |
|||
|
|||
@IsArray() |
|||
@IsOptional() |
|||
sectors?: Prisma.InputJsonArray; |
|||
|
|||
@IsString() |
|||
symbol: string; |
|||
|
|||
@IsObject() |
|||
@IsOptional() |
|||
symbolMapping?: { |
|||
[dataProvider: string]: string; |
|||
}; |
|||
|
|||
@IsOptional() |
|||
@IsUrl({ |
|||
protocols: ['https'], |
|||
require_protocol: true |
|||
}) |
|||
url?: string; |
|||
} |
@ -0,0 +1,17 @@ |
|||
import { MarketData } from '@ghostfolio/common/interfaces'; |
|||
|
|||
import { DataSource } from '@prisma/client'; |
|||
import { IsArray, IsEnum, IsOptional } from 'class-validator'; |
|||
|
|||
import { CreateAssetProfileDto } from '../admin/create-asset-profile.dto'; |
|||
|
|||
export class CreateAssetProfileWithMarketDataDto extends CreateAssetProfileDto { |
|||
@IsEnum([DataSource.MANUAL], { |
|||
message: `dataSource must be '${DataSource.MANUAL}'` |
|||
}) |
|||
dataSource: DataSource; |
|||
|
|||
@IsArray() |
|||
@IsOptional() |
|||
marketData?: MarketData[]; |
|||
} |
@ -0,0 +1,4 @@ |
|||
export interface MarketData { |
|||
date: string; |
|||
marketPrice: number; |
|||
} |
Loading…
Reference in new issue