mirror of https://github.com/ghostfolio/ghostfolio
				
				
			
				 11 changed files with 218 additions and 17 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,11 @@ | 
				
			|||
import { MarketData } from '@ghostfolio/common/interfaces/market-data.interface'; | 
				
			|||
 | 
				
			|||
import { IsArray, IsOptional } from 'class-validator'; | 
				
			|||
 | 
				
			|||
import { CreateAssetProfileDto } from '../admin/create-asset-profile.dto'; | 
				
			|||
 | 
				
			|||
export class CreateAssetProfileWithMarketDataDto extends CreateAssetProfileDto { | 
				
			|||
  @IsArray() | 
				
			|||
  @IsOptional() | 
				
			|||
  marketData?: MarketData[]; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,4 @@ | 
				
			|||
export interface MarketData { | 
				
			|||
  date: string; | 
				
			|||
  marketPrice: number; | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue