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, symbol,
symbolMapping symbolMapping
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) { }: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
await this.symbolProfileService.updateSymbolProfile({ let updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = {
assetClass, assetClass,
assetSubClass, assetSubClass,
comment, comment,
countries, countries,
currency, currency,
dataSource, dataSource,
name,
scraperConfiguration, scraperConfiguration,
sectors, sectors,
symbol, symbol,
symbolMapping 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([ 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, scraperConfiguration,
sectors, sectors,
symbol, symbol,
symbolMapping symbolMapping,
SymbolProfileOverrides
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) { }: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
return this.prismaService.symbolProfile.update({ return this.prismaService.symbolProfile.update({
data: { data: {
@ -109,7 +110,8 @@ export class SymbolProfileService {
name, name,
scraperConfiguration, scraperConfiguration,
sectors, sectors,
symbolMapping symbolMapping,
SymbolProfileOverrides
}, },
where: { dataSource_symbol: { dataSource, symbol } } 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> </ng-container>
</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>Name</mat-label> <mat-label i18n>Name</mat-label>
<input formControlName="name" matInput type="text" /> <input formControlName="name" matInput type="text" />

Loading…
Cancel
Save