Browse Source

Allow editing of asset class and asset sub class

pull/3218/head
Nicolas Fedor 1 year ago
parent
commit
fa3bfb3bf6
  1. 19
      apps/api/src/app/admin/admin.service.ts
  2. 4
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

19
apps/api/src/app/admin/admin.service.ts

@ -25,6 +25,7 @@ import { MarketDataPreset } from '@ghostfolio/common/types';
import { BadRequestException, Injectable } from '@nestjs/common'; import { BadRequestException, Injectable } from '@nestjs/common';
import { import {
$Enums,
AssetSubClass, AssetSubClass,
DataSource, DataSource,
Prisma, Prisma,
@ -334,10 +335,14 @@ export class AdminService {
symbol, symbol,
symbolMapping symbolMapping
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) { }: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
const symbolProfileOverride = {
name: name as string,
assetClass: assetClass as $Enums.AssetClass,
assetSubClass: assetSubClass as $Enums.AssetSubClass
};
const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset =
{ {
assetClass,
assetSubClass,
comment, comment,
countries, countries,
currency, currency,
@ -347,16 +352,12 @@ export class AdminService {
symbol, symbol,
symbolMapping, symbolMapping,
...(dataSource === 'MANUAL' ...(dataSource === 'MANUAL'
? { name } ? { name, assetClass, assetSubClass }
: { : {
SymbolProfileOverrides: { SymbolProfileOverrides: {
upsert: { upsert: {
create: { create: symbolProfileOverride,
name: name as string update: symbolProfileOverride
},
update: {
name: name as string
}
} }
} }
}) })

4
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -224,7 +224,7 @@
/> />
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="assetProfile?.dataSource === 'MANUAL'" class="mt-3"> <div class="mt-3">
<mat-form-field appearance="outline" class="w-100 without-hint"> <mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Asset Class</mat-label> <mat-label i18n>Asset Class</mat-label>
<mat-select formControlName="assetClass"> <mat-select formControlName="assetClass">
@ -237,7 +237,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="assetProfile?.dataSource === 'MANUAL'" class="mt-3"> <div class="mt-3">
<mat-form-field appearance="outline" class="w-100 without-hint"> <mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Asset Sub Class</mat-label> <mat-label i18n>Asset Sub Class</mat-label>
<mat-select formControlName="assetSubClass"> <mat-select formControlName="assetSubClass">

Loading…
Cancel
Save