Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import { Injectable } from '@nestjs/common'; import { DataSource } from 'typeorm'; import { VariableValuesService } from '@amalia/assignments/quotas/core'; import { Company } from '@amalia/core/models'; import { DefinitionsContainerFactory, FiltersService, RelationshipsService, RulesService, VariablesService, } from '@amalia/payout-definition/designer/core'; import { CurrencyRatesService } from '@amalia/tenants/companies/currency-rates/core'; import { StatementCalculationCache } from './StatementCalculation.cache'; import { StoppableCalculation } from './stoppableCalculation'; export interface StatementCalculationCacheScope { planId?: string; ruleIds?: string[]; } @Injectable() export class StatementCalculationCacheFactory { public constructor( private readonly datasource: DataSource, private readonly filtersService: FiltersService, private readonly rulesService: RulesService, private readonly variablesService: VariablesService, private readonly currencyRatesService: CurrencyRatesService, private readonly variableValuesService: VariableValuesService, private readonly relationshipsService: RelationshipsService, private readonly definitionsContainerFactory: DefinitionsContainerFactory, ) {} public async instantiate( company: Company, scope: StatementCalculationCacheScope, stoppableCalculation?: StoppableCalculation, ): Promise<StatementCalculationCache> { const statementCalculationCache = new StatementCalculationCache( this.datasource, company, stoppableCalculation || null, this.filtersService, this.rulesService, this.variablesService, this.currencyRatesService, this.variableValuesService, this.relationshipsService, this.definitionsContainerFactory, ); await statementCalculationCache.init(scope); return statementCalculationCache; } } |