Browse Source

not custom asset profiles filtered out

pull/5243/head
Attila Cseh 4 weeks ago
parent
commit
396ca3a664
  1. 19
      apps/api/src/app/import/import.service.ts

19
apps/api/src/app/import/import.service.ts

@ -236,7 +236,15 @@ export class ImportService {
}
}
if (!isDryRun && assetProfilesWithMarketDataDto?.length) {
if (!isDryRun && assetProfilesWithMarketDataDto) {
// Filter out not custom asset profiles
assetProfilesWithMarketDataDto = assetProfilesWithMarketDataDto.filter(
(assetProfile) => {
return assetProfile.dataSource === DataSource.MANUAL;
}
);
if (assetProfilesWithMarketDataDto.length) {
const existingAssetProfiles =
await this.symbolProfileService.getSymbolProfiles(
assetProfilesWithMarketDataDto.map(({ dataSource, symbol }) => {
@ -251,13 +259,17 @@ export class ImportService {
return (
existingAssetProfile.dataSource ===
assetProfileWithMarketData.dataSource &&
existingAssetProfile.symbol === assetProfileWithMarketData.symbol
existingAssetProfile.symbol ===
assetProfileWithMarketData.symbol
);
}
);
// If there is no asset profile or if the asset profile belongs to a different user then create a new asset profile
if (!existingAssetProfile || existingAssetProfile.userId !== user.id) {
if (
!existingAssetProfile ||
existingAssetProfile.userId !== user.id
) {
const assetProfile: CreateAssetProfileDto = omit(
assetProfileWithMarketData,
'marketData'
@ -293,6 +305,7 @@ export class ImportService {
await this.marketDataService.updateMany({ data: marketDataObjects });
}
}
}
for (const activity of activitiesDto) {
if (!activity.dataSource) {

Loading…
Cancel
Save