From 0ec9c1dd934f34b2153aef536e492b1024537565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20G=C3=BCnther?= Date: Fri, 24 Oct 2025 19:51:14 +0200 Subject: [PATCH] Bugfix/custom asset name rendering in import activities dialog (#5787) * Fix custom asset name rendering in import activities dialog * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/import/import.service.ts | 12 +++++++++++- apps/api/src/app/order/create-order.dto.ts | 3 ++- apps/api/src/app/order/order.service.ts | 4 ++-- .../src/app/services/import-activities.service.ts | 6 +----- .../activities-table/activities-table.component.html | 5 ++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d836e9a..f1abea2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the style in the footer row of the accounts table +- Fixed the rendering of names and symbols for custom assets in the import activities dialog ## 2.210.1 - 2025-10-22 diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 2725747aa..2ec28365e 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -539,6 +539,7 @@ export class ImportService { connectOrCreate: { create: { dataSource, + name, symbol, currency: assetProfile.currency, userId: dataSource === 'MANUAL' ? user.id : undefined @@ -746,10 +747,19 @@ export class ImportService { if (['FEE', 'INTEREST', 'LIABILITY'].includes(type)) { // Skip asset profile validation for FEE, INTEREST, and LIABILITY // as these activity types don't require asset profiles + const assetProfileInImport = assetProfilesWithMarketDataDto?.find( + (profile) => { + return ( + profile.dataSource === dataSource && profile.symbol === symbol + ); + } + ); + assetProfiles[getAssetProfileIdentifier({ dataSource, symbol })] = { currency, dataSource, - symbol + symbol, + name: assetProfileInImport?.name }; continue; diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index ba7a1d868..fb4ac32dd 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/apps/api/src/app/order/create-order.dto.ts @@ -44,7 +44,8 @@ export class CreateOrderDto { customCurrency?: string; @IsEnum(DataSource) - dataSource: DataSource; + @IsOptional() // Optional for type FEE, INTEREST, and LIABILITY (default data source is resolved in the backend) + dataSource?: DataSource; @IsISO8601() @Validate(IsAfter1970Constraint) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 11579bbf1..2b5d14150 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -129,7 +129,7 @@ export class OrderService { const assetSubClass = data.assetSubClass; const dataSource: DataSource = 'MANUAL'; - let name: string; + let name = data.SymbolProfile.connectOrCreate.create.name; let symbol: string; if ( @@ -142,7 +142,7 @@ export class OrderService { symbol = data.SymbolProfile.connectOrCreate.create.symbol; } else { // Create custom asset profile - name = data.SymbolProfile.connectOrCreate.create.symbol; + name = name ?? data.SymbolProfile.connectOrCreate.create.symbol; symbol = uuidv4(); } diff --git a/apps/client/src/app/services/import-activities.service.ts b/apps/client/src/app/services/import-activities.service.ts index 323f07a5b..0f2715e47 100644 --- a/apps/client/src/app/services/import-activities.service.ts +++ b/apps/client/src/app/services/import-activities.service.ts @@ -76,12 +76,8 @@ export class ImportActivitiesService { updateAccountBalance: false }); - if ( - dataSource === DataSource.MANUAL && - !['FEE', 'INTEREST', 'LIABILITY'].includes(type) - ) { + if (dataSource === DataSource.MANUAL) { // Create synthetic asset profile for MANUAL data source - // (except for FEE, INTEREST, and LIABILITY which don't require asset profiles) assetProfiles.push({ currency, symbol, diff --git a/libs/ui/src/lib/activities-table/activities-table.component.html b/libs/ui/src/lib/activities-table/activities-table.component.html index 8079a6258..843832e1a 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.html +++ b/libs/ui/src/lib/activities-table/activities-table.component.html @@ -143,7 +143,10 @@ } - @if (!isUUID(element.SymbolProfile?.symbol)) { + @if ( + element.SymbolProfile?.dataSource !== 'MANUAL' && + !isUUID(element.SymbolProfile?.symbol) + ) {
{{ element.SymbolProfile?.symbol | gfSymbol