Browse Source

fix: create SymbolProfile when missing before update (fixes #6308)

- In patchAssetProfileData, ensure SymbolProfile exists before update;
  create via addAssetProfile when missing to avoid Prisma P2025
- Refresh admin market data table on asset profile dialog close and on save
  (onSaved callback) so UI reflects changes in real time
pull/6315/head
irfanfaraaz 2 months ago
parent
commit
d6ed876343
  1. 13
      apps/api/src/app/admin/admin.service.ts
  2. 15
      apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
  3. 1
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  4. 1
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/interfaces/interfaces.ts

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

@ -614,6 +614,19 @@ export class AdminService {
);
}
} else {
const [existingProfile] =
await this.symbolProfileService.getSymbolProfiles([
{ dataSource, symbol }
]);
if (!existingProfile) {
await this.addAssetProfile({
dataSource,
symbol,
currency: currency as string
});
}
const symbolProfileOverrides = {
assetClass: assetClass as AssetClass,
assetSubClass: assetSubClass as AssetSubClass,

15
apps/client/src/app/components/admin-market-data/admin-market-data.component.ts

@ -439,7 +439,14 @@ export class GfAdminMarketDataComponent
symbol,
colorScheme: this.user?.settings.colorScheme,
deviceType: this.deviceType,
locale: this.user?.settings?.locale
locale: this.user?.settings?.locale,
onSaved: () => {
this.loadData({
pageIndex: this.paginator?.pageIndex ?? 0,
sortColumn: this.sort?.active,
sortDirection: this.sort?.direction
});
}
},
height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
@ -450,6 +457,12 @@ export class GfAdminMarketDataComponent
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(
(newAssetProfileIdentifier: AssetProfileIdentifier | undefined) => {
this.loadData({
pageIndex: this.paginator?.pageIndex ?? 0,
sortColumn: this.sort?.active,
sortDirection: this.sort?.direction
});
if (newAssetProfileIdentifier) {
this.onOpenAssetProfileDialog(newAssetProfileIdentifier);
} else {

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

@ -582,6 +582,7 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {
}
);
this.data.onSaved?.();
this.initialize();
},
error: (error) => {

1
apps/client/src/app/components/admin-market-data/asset-profile-dialog/interfaces/interfaces.ts

@ -7,5 +7,6 @@ export interface AssetProfileDialogParams {
dataSource: DataSource;
deviceType: string;
locale: string;
onSaved?: () => void;
symbol: string;
}

Loading…
Cancel
Save