Browse Source

style(api): extract calculationType constant in portfolio-changed listener

pull/8351/head
KenTandrian 4 weeks ago
parent
commit
728d8fd4ae
  1. 14
      apps/api/src/events/portfolio-changed.listener.ts

14
apps/api/src/events/portfolio-changed.listener.ts

@ -69,25 +69,25 @@ export class PortfolioChangedListener {
userSettings userSettings
}); });
const calculationType =
userSettings.performanceCalculationType ??
PerformanceCalculationType.ROAI;
// Recompute in the background to avoid a cold start on the next request // Recompute in the background to avoid a cold start on the next request
await this.portfolioSnapshotService.addJobToQueue({ await this.portfolioSnapshotService.addJobToQueue({
data: { data: {
calculationType,
filters, filters,
userId, userId,
calculationType:
userSettings.performanceCalculationType ??
PerformanceCalculationType.ROAI,
userCurrency: userSettings.baseCurrency ?? DEFAULT_CURRENCY userCurrency: userSettings.baseCurrency ?? DEFAULT_CURRENCY
}, },
name: PORTFOLIO_SNAPSHOT_PROCESS_JOB_NAME, name: PORTFOLIO_SNAPSHOT_PROCESS_JOB_NAME,
opts: { opts: {
...PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS, ...PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS,
jobId: this.redisCacheService.getPortfolioSnapshotKey({ jobId: this.redisCacheService.getPortfolioSnapshotKey({
calculationType,
filters, filters,
userId, userId
calculationType:
userSettings.performanceCalculationType ??
PerformanceCalculationType.ROAI
}), }),
priority: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW priority: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW
} }

Loading…
Cancel
Save