Browse Source

Fixes after feedback

pull/2854/head
Hugo Persson 2 years ago
committed by Thomas Kaul
parent
commit
328b18e0ad
  1. 16
      apps/api/src/app/admin/update-asset-profile.dto.ts
  2. 13
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  3. 3
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

16
apps/api/src/app/admin/update-asset-profile.dto.ts

@ -16,6 +16,10 @@ export class UpdateAssetProfileDto {
@IsOptional()
assetSubClass?: AssetSubClass;
@IsArray()
@IsOptional()
countries?: Prisma.InputJsonArray;
@IsString()
@IsOptional()
comment?: string;
@ -32,17 +36,13 @@ export class UpdateAssetProfileDto {
@IsOptional()
scraperConfiguration?: Prisma.InputJsonObject;
@IsObject()
@IsOptional()
symbolMapping?: {
[dataProvider: string]: string;
};
@IsArray()
@IsOptional()
sectors?: Prisma.InputJsonArray;
@IsArray()
@IsObject()
@IsOptional()
countries?: Prisma.InputJsonArray;
symbolMapping?: {
[dataProvider: string]: string;
};
}

13
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

@ -138,6 +138,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
};
}
}
this.assetProfileForm.setValue({
assetClass: this.assetProfile.assetClass ?? null,
assetSubClass: this.assetProfile.assetSubClass ?? null,
@ -152,13 +153,12 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
),
symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}),
countries: JSON.stringify(
assetProfile.countries.map((e) => {
return { code: e.code, weight: e.weight };
assetProfile.countries.map(({code, weight}) => {
return { code, weight};
}) ?? []
),
sectors: JSON.stringify(assetProfile.sectors ?? [])
});
console.log(this.assetProfileForm.value);
this.assetProfileForm.markAsPristine();
@ -247,11 +247,10 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
}
public onSubmit() {
let scraperConfiguration = {};
let symbolMapping = {};
let countries = [];
let scraperConfiguration = {};
let sectors = [];
let symbolMapping = {};
try {
scraperConfiguration = JSON.parse(
@ -278,12 +277,12 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
symbolMapping,
assetClass: this.assetProfileForm.controls['assetClass'].value,
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value,
countries,
comment: this.assetProfileForm.controls['comment'].value ?? null,
currency: (<Currency>(
(<unknown>this.assetProfileForm.controls['currency'].value)
))?.value,
name: this.assetProfileForm.controls['name'].value,
countries,
sectors
};
console.log(assetProfileData);

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

@ -264,7 +264,6 @@
</mat-form-field>
</div>
<div *ngIf="assetProfile?.dataSource === 'MANUAL'">
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Sectors</mat-label>
@ -276,8 +275,6 @@
></textarea>
</mat-form-field>
</div>
<div *ngIf="assetProfile?.dataSource === 'MANUAL'">
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Countries</mat-label>

Loading…
Cancel
Save