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
});
if (!order.isDraft) {
// Gather symbol data in the background, if not draft
if (data.dataSource !== 'MANUAL' && !order.isDraft) {
// Gather symbol data in the background, if data source not
// MANUAL and not draft
this.dataGatheringService.gatherSymbols([
{
dataSource: data.dataSource,

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

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

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

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

Loading…
Cancel
Save