From 98de2355c4af43c5ee1f6730167f3f74f8e93eb9 Mon Sep 17 00:00:00 2001 From: Fedron <40535546+Fedron@users.noreply.github.com> Date: Fri, 29 Mar 2024 08:35:41 +0000 Subject: [PATCH] Feature/Support overriding name of asset profile dialog (#3199) * Support overriding name of asset profile dialog * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/admin/admin.service.ts | 42 +++++++++++++------ .../symbol-profile/symbol-profile.service.ts | 6 ++- .../asset-profile-dialog.html | 2 +- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b678ba9..28768ce6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Extended the export functionality by the user account’s currency +- Added support to override the name of an asset profile in the asset profile details dialog of the admin control ### Fixed diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 06ccdf379..2e7f76610 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -331,19 +331,35 @@ export class AdminService { symbol, symbolMapping }: Prisma.SymbolProfileUpdateInput & UniqueAsset) { - await this.symbolProfileService.updateSymbolProfile({ - assetClass, - assetSubClass, - comment, - countries, - currency, - dataSource, - name, - scraperConfiguration, - sectors, - symbol, - symbolMapping - }); + const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = + { + assetClass, + assetSubClass, + comment, + countries, + currency, + dataSource, + scraperConfiguration, + sectors, + symbol, + symbolMapping, + ...(dataSource === 'MANUAL' + ? { name } + : { + SymbolProfileOverrides: { + upsert: { + create: { + name: name as string + }, + update: { + name: name as string + } + } + } + }) + }; + + await this.symbolProfileService.updateSymbolProfile(updatedSymbolProfile); const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles([ { diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.ts index 751feda22..656b7b7e4 100644 --- a/apps/api/src/services/symbol-profile/symbol-profile.service.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts @@ -97,7 +97,8 @@ export class SymbolProfileService { scraperConfiguration, sectors, symbol, - symbolMapping + symbolMapping, + SymbolProfileOverrides }: Prisma.SymbolProfileUpdateInput & UniqueAsset) { return this.prismaService.symbolProfile.update({ data: { @@ -109,7 +110,8 @@ export class SymbolProfileService { name, scraperConfiguration, sectors, - symbolMapping + symbolMapping, + SymbolProfileOverrides }, where: { dataSource_symbol: { dataSource, symbol } } }); diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html index e1695ef6d..51397fe26 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html @@ -205,7 +205,7 @@ } -
+
Name