Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/Support overriding name of asset profile dialog (#3199)

Fedron98de2355c4af
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34b678ba99..28768ce6ce 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 06ccdf379d..2e7f766100 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 751feda22a..656b7b7e41 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 e1695ef6da..51397fe260 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 @@
}
</ng-container>
</div>
- <div *ngIf="assetProfile?.dataSource === 'MANUAL'" class="mt-3">
+ <div class="mt-3">
<mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Name</mat-label>
<input formControlName="name" matInput type="text" />