Browse Source

Allow updating name of asset profile

pull/3199/head
Nicolas Fedor 1 year ago
parent
commit
635ebf1aec
  1. 28
      apps/api/src/app/admin/admin.service.ts
  2. 6
      apps/api/src/services/symbol-profile/symbol-profile.service.ts
  3. 2
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

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

@ -331,19 +331,41 @@ export class AdminService {
symbol,
symbolMapping
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
await this.symbolProfileService.updateSymbolProfile({
let updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = {
assetClass,
assetSubClass,
comment,
countries,
currency,
dataSource,
name,
scraperConfiguration,
sectors,
symbol,
symbolMapping
});
};
if (dataSource === 'MANUAL') {
updatedSymbolProfile = {
...updatedSymbolProfile,
name
};
} else {
updatedSymbolProfile = {
...updatedSymbolProfile,
SymbolProfileOverrides: {
upsert: {
create: {
name: name as string
},
update: {
name: name as string
}
}
}
};
}
await this.symbolProfileService.updateSymbolProfile(updatedSymbolProfile);
const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles([
{

6
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 } }
});

2
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" />

Loading…
Cancel
Save