Browse Source

Improve promises in patchAssetProfileData()

pull/6938/head
Thomas Kaul 1 day ago
parent
commit
d0877c73d2
  1. 36
      apps/api/src/app/admin/admin.service.ts

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

@ -576,8 +576,8 @@ export class AdminService {
} }
try { try {
Promise.all([ await Promise.all([
await this.symbolProfileService.updateAssetProfileIdentifier( this.symbolProfileService.updateAssetProfileIdentifier(
{ {
dataSource, dataSource,
symbol symbol
@ -587,7 +587,7 @@ export class AdminService {
symbol: newSymbol as string symbol: newSymbol as string
} }
), ),
await this.marketDataService.updateAssetProfileIdentifier( this.marketDataService.updateAssetProfileIdentifier(
{ {
dataSource, dataSource,
symbol symbol
@ -599,12 +599,15 @@ export class AdminService {
) )
]); ]);
return this.symbolProfileService.getSymbolProfiles([ const [updatedAssetProfile] =
{ await this.symbolProfileService.getSymbolProfiles([
dataSource: DataSource[newDataSource.toString()], {
symbol: newSymbol as string dataSource: DataSource[newDataSource.toString()],
} symbol: newSymbol as string
])?.[0]; }
]);
return updatedAssetProfile;
} catch { } catch {
throw new HttpException( throw new HttpException(
getReasonPhrase(StatusCodes.BAD_REQUEST), getReasonPhrase(StatusCodes.BAD_REQUEST),
@ -650,12 +653,15 @@ export class AdminService {
updatedSymbolProfile updatedSymbolProfile
); );
return this.symbolProfileService.getSymbolProfiles([ const [updatedAssetProfile] =
{ await this.symbolProfileService.getSymbolProfiles([
dataSource: dataSource as DataSource, {
symbol: symbol as string dataSource: dataSource as DataSource,
} symbol: symbol as string
])?.[0]; }
]);
return updatedAssetProfile;
} }
} }

Loading…
Cancel
Save