Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/import of custom asset profiles (#5670)
Sven Güntherc5c11929008a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 58a7b3b487..c7472e4215 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed- Fixed the server startup message to properly display IPv6 addresses+- Fixed an issue where importing custom asset profiles failed due to validation errors## 2.207.0 - 2025-10-08diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.tsindex 82231d237d..69ec781c3e 100644--- a/apps/api/src/app/import/import.service.ts+++ b/apps/api/src/app/import/import.service.ts@@ -373,6 +373,7 @@ export class ImportService {const assetProfiles = await this.validateActivities({activitiesDto,+ assetProfilesWithMarketDataDto,maxActivitiesToImport,user});@@ -698,10 +699,12 @@ export class ImportService {private async validateActivities({activitiesDto,+ assetProfilesWithMarketDataDto,maxActivitiesToImport,user}: {activitiesDto: Partial<CreateOrderDto>[];+ assetProfilesWithMarketDataDto: ImportDataDto['assetProfiles'];maxActivitiesToImport: number;user: UserWithSettings;}) {@@ -749,6 +752,41 @@ export class ImportService {)?.[symbol]};+ if (!assetProfile?.name) {+ const assetProfileInImport = assetProfilesWithMarketDataDto?.find(+ (profile) => {+ return (+ profile.dataSource === dataSource && profile.symbol === symbol+ );+ }+ );++ if (assetProfileInImport) {+ // Merge all fields of custom asset profiles into the validation object+ Object.assign(assetProfile, {+ assetClass: assetProfileInImport.assetClass,+ assetSubClass: assetProfileInImport.assetSubClass,+ comment: assetProfileInImport.comment,+ countries: assetProfileInImport.countries,+ currency: assetProfileInImport.currency,+ cusip: assetProfileInImport.cusip,+ dataSource: assetProfileInImport.dataSource,+ figi: assetProfileInImport.figi,+ figiComposite: assetProfileInImport.figiComposite,+ figiShareClass: assetProfileInImport.figiShareClass,+ holdings: assetProfileInImport.holdings,+ isActive: assetProfileInImport.isActive,+ isin: assetProfileInImport.isin,+ name: assetProfileInImport.name,+ scraperConfiguration: assetProfileInImport.scraperConfiguration,+ sectors: assetProfileInImport.sectors,+ symbol: assetProfileInImport.symbol,+ symbolMapping: assetProfileInImport.symbolMapping,+ url: assetProfileInImport.url+ });+ }+ }+if ((dataSource !== 'MANUAL' && type === 'BUY') ||type === 'DIVIDEND' ||diff --git a/test/import/ok/penthouse-apartment.json b/test/import/ok/penthouse-apartment.jsonnew file mode 100644index 0000000000..3b230cf760--- /dev/null+++ b/test/import/ok/penthouse-apartment.json@@ -0,0 +1,53 @@+{+ "meta": {+ "date": "2023-02-05T00:00:00.000Z",+ "version": "dev"+ },+ "accounts": [],+ "assetProfiles": [+ {+ "assetClass": null,+ "assetSubClass": null,+ "comment": null,+ "countries": [],+ "currency": "USD",+ "cusip": null,+ "dataSource": "MANUAL",+ "figi": null,+ "figiComposite": null,+ "figiShareClass": null,+ "holdings": [],+ "isActive": true,+ "isin": null,+ "marketData": [],+ "name": "Penthouse Apartment",+ "scraperConfiguration": null,+ "sectors": [],+ "symbol": "7e91b7d4-1430-4212-8380-289a06c9bbc1",+ "symbolMapping": {},+ "url": null+ }+ ],+ "platforms": [],+ "tags": [],+ "activities": [+ {+ "accountId": null,+ "comment": null,+ "currency": "USD",+ "dataSource": "MANUAL",+ "date": "2022-01-01T00:00:00.000Z",+ "fee": 0,+ "quantity": 1,+ "symbol": "7e91b7d4-1430-4212-8380-289a06c9bbc1",+ "tags": [],+ "type": "BUY",+ "unitPrice": 500000,+ }+ ],+ "user": {+ "settings": {+ "currency": "USD"+ }+ }+}