From e863423a55dcfa44b26be6d43ca01df556a9f8e1 Mon Sep 17 00:00:00 2001 From: Attila Cseh Date: Sat, 26 Jul 2025 10:47:10 +0200 Subject: [PATCH] code review changes --- CHANGELOG.md | 2 +- apps/api/src/app/import/import.service.ts | 16 +++++++--------- .../app/services/import-activities.service.ts | 2 +- package-lock.json | 1 - package.json | 1 - 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4b7aaed1..1a9494ce8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Extended the import functionality by custom asset profiles - Refactored the toggle component to standalone - Improved the language localization for Dutch (`nl`) - Improved the language localization for Portuguese (`pt`) @@ -25,7 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `ngx-stripe` from version `19.7.0` to `20.7.0` - Upgraded `Nx` from version `21.1.2` to `21.2.4` - Upgraded `storybook` from version `8.6.12` to `9.0.17` -- Extended the import functionality by custom asset profiles ### Fixed diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index ccdeb6988..d229098e2 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -236,11 +236,11 @@ export class ImportService { } } - if (!isDryRun && assetProfilesWithMarketDataDto) { + if (!isDryRun && assetProfilesWithMarketDataDto?.length) { // Filter out not custom asset profiles assetProfilesWithMarketDataDto = assetProfilesWithMarketDataDto.filter( - (assetProfile) => { - return assetProfile.dataSource === DataSource.MANUAL; + ({ dataSource }) => { + return dataSource === DataSource.MANUAL; } ); @@ -255,17 +255,15 @@ export class ImportService { for (const assetProfileWithMarketData of assetProfilesWithMarketDataDto) { // Check if there is any existing asset profile const existingAssetProfile = existingAssetProfiles.find( - (existingAssetProfile) => { + ({ dataSource, symbol }) => { return ( - existingAssetProfile.dataSource === - assetProfileWithMarketData.dataSource && - existingAssetProfile.symbol === - assetProfileWithMarketData.symbol + dataSource === assetProfileWithMarketData.dataSource && + 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 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 diff --git a/apps/client/src/app/services/import-activities.service.ts b/apps/client/src/app/services/import-activities.service.ts index b70713758..6c331cc2c 100644 --- a/apps/client/src/app/services/import-activities.service.ts +++ b/apps/client/src/app/services/import-activities.service.ts @@ -124,7 +124,7 @@ export class ImportActivitiesService { importData.push(this.convertToCreateOrderDto(activity)); } - return this.importJson({ accounts, activities: importData, assetProfiles }); + return this.importJson({ accounts, assetProfiles, activities: importData }); } private convertToCreateOrderDto({ diff --git a/package-lock.json b/package-lock.json index 479e78ab8..2183cfaef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -122,7 +122,6 @@ "@nx/node": "21.2.4", "@nx/storybook": "21.2.4", "@nx/web": "21.2.4", - "@nx/webpack": "21.2.4", "@nx/workspace": "21.2.4", "@schematics/angular": "20.0.6", "@storybook/addon-docs": "9.0.17", diff --git a/package.json b/package.json index 70e5d6d8b..86ff201e0 100644 --- a/package.json +++ b/package.json @@ -168,7 +168,6 @@ "@nx/node": "21.2.4", "@nx/storybook": "21.2.4", "@nx/web": "21.2.4", - "@nx/webpack": "21.2.4", "@nx/workspace": "21.2.4", "@schematics/angular": "20.0.6", "@storybook/addon-docs": "9.0.17",