Browse Source

Fix asset class overwrite

pull/5027/head
Dan 1 year ago
parent
commit
87ab9a65ff
  1. 49
      apps/api/src/app/admin/admin.controller.ts
  2. 5
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

49
apps/api/src/app/admin/admin.controller.ts

@ -327,45 +327,16 @@ export class AdminController {
@Param('dataSource') dataSource: DataSource, @Param('dataSource') dataSource: DataSource,
@Param('symbol') symbol: string @Param('symbol') symbol: string
): Promise<EnhancedSymbolProfile> { ): Promise<EnhancedSymbolProfile> {
if (dataSource === 'MANUAL') { return this.adminService.patchAssetProfileData({
await this.adminService.patchAssetProfileData({ ...assetProfileData,
dataSource, dataSource,
symbol, symbol,
tags: { tags: {
set: [] connect: assetProfileData.tags?.map(({ id }) => {
} return { id };
}); })
}
return this.adminService.patchAssetProfileData({ });
...assetProfileData,
dataSource,
symbol,
tags: {
connect: assetProfileData.tags?.map(({ id }) => {
return { id };
})
}
});
} else {
await this.adminService.patchAssetProfileData({
dataSource,
symbol,
tags: {
set: []
}
});
return this.adminService.patchAssetProfileData({
...assetProfileData,
dataSource,
symbol,
tags: {
connect: assetProfileData.tags?.map(({ id }) => {
return { id };
})
}
});
}
} }
@HasPermission(permissions.accessAdminControl) @HasPermission(permissions.accessAdminControl)

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

@ -188,7 +188,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
), ),
sectors: JSON.stringify(this.assetProfile?.sectors ?? []), sectors: JSON.stringify(this.assetProfile?.sectors ?? []),
symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}), symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}),
url: this.assetProfile?.url ?? '' url: this.assetProfile?.url
}); });
this.assetProfileForm.markAsPristine(); this.assetProfileForm.markAsPristine();
@ -323,6 +323,9 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
url: this.assetProfileForm.controls['url'].value url: this.assetProfileForm.controls['url'].value
}; };
assetProfileData.url =
assetProfileData.url?.length > 0 ? assetProfileData.url : null;
this.adminService this.adminService
.patchAssetProfile({ .patchAssetProfile({
...assetProfileData, ...assetProfileData,

Loading…
Cancel
Save