Browse Source

Skip data gathering

pull/2379/head
Thomas 2 years ago
parent
commit
db3f26fe40
  1. 5
      apps/api/src/app/order/order.controller.ts
  2. 26
      apps/api/src/app/order/order.service.ts
  3. 4
      apps/api/src/services/data-gathering/data-gathering.service.ts

5
apps/api/src/app/order/order.controller.ts

@ -147,8 +147,9 @@ export class OrderController {
userId: this.request.user.id userId: this.request.user.id
}); });
if (!order.isDraft) { if (data.dataSource !== 'MANUAL' && !order.isDraft) {
// Gather symbol data in the background, if not draft // Gather symbol data in the background, if data source not
// MANUAL and not draft
this.dataGatheringService.gatherSymbols([ this.dataGatheringService.gatherSymbols([
{ {
dataSource: data.dataSource, dataSource: data.dataSource,

26
apps/api/src/app/order/order.service.ts

@ -123,20 +123,22 @@ export class OrderService {
}; };
} }
this.dataGatheringService.addJobToQueue({ if (data.SymbolProfile.connectOrCreate.create.dataSource !== 'MANUAL') {
data: { this.dataGatheringService.addJobToQueue({
dataSource: data.SymbolProfile.connectOrCreate.create.dataSource, data: {
symbol: data.SymbolProfile.connectOrCreate.create.symbol
},
name: GATHER_ASSET_PROFILE_PROCESS,
opts: {
...GATHER_ASSET_PROFILE_PROCESS_OPTIONS,
jobId: getAssetProfileIdentifier({
dataSource: data.SymbolProfile.connectOrCreate.create.dataSource, dataSource: data.SymbolProfile.connectOrCreate.create.dataSource,
symbol: data.SymbolProfile.connectOrCreate.create.symbol symbol: data.SymbolProfile.connectOrCreate.create.symbol
}) },
} name: GATHER_ASSET_PROFILE_PROCESS,
}); opts: {
...GATHER_ASSET_PROFILE_PROCESS_OPTIONS,
jobId: getAssetProfileIdentifier({
dataSource: data.SymbolProfile.connectOrCreate.create.dataSource,
symbol: data.SymbolProfile.connectOrCreate.create.symbol
})
}
});
}
delete data.accountId; delete data.accountId;
delete data.assetClass; delete data.assetClass;

4
apps/api/src/services/data-gathering/data-gathering.service.ts

@ -127,6 +127,10 @@ export class DataGatheringService {
uniqueAssets = await this.getUniqueAssets(); uniqueAssets = await this.getUniqueAssets();
} }
if (uniqueAssets.length <= 0) {
return;
}
const assetProfiles = const assetProfiles =
await this.dataProviderService.getAssetProfiles(uniqueAssets); await this.dataProviderService.getAssetProfiles(uniqueAssets);
const symbolProfiles = const symbolProfiles =

Loading…
Cancel
Save