Browse Source
Feature/restructure portfolio report response (part 2) (#5282)
* Restructure response of portfolio report endpoint
pull/5288/head
Thomas Kaul
2 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
11 additions and
11 deletions
-
apps/api/src/app/portfolio/portfolio.controller.ts
-
apps/api/src/app/portfolio/portfolio.service.ts
-
apps/client/src/app/pages/portfolio/x-ray/x-ray-page.component.ts
-
libs/common/src/lib/interfaces/responses/portfolio-report.interface.ts
|
|
@ -655,11 +655,11 @@ export class PortfolioController { |
|
|
|
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') && |
|
|
|
this.request.user.subscription.type === 'Basic' |
|
|
|
) { |
|
|
|
for (const rule in report['x-ray'].rules) { |
|
|
|
report['x-ray'].rules[rule] = null; |
|
|
|
for (const rule in report.xRay.rules) { |
|
|
|
report.xRay.rules[rule] = null; |
|
|
|
} |
|
|
|
|
|
|
|
report['x-ray'].statistics = { |
|
|
|
report.xRay.statistics = { |
|
|
|
rulesActiveCount: 0, |
|
|
|
rulesFulfilledCount: 0 |
|
|
|
}; |
|
|
|
|
|
@ -1157,7 +1157,7 @@ export class PortfolioService { |
|
|
|
}) |
|
|
|
).toNumber(); |
|
|
|
|
|
|
|
const rules: PortfolioReportResponse['x-ray']['rules'] = { |
|
|
|
const rules: PortfolioReportResponse['xRay']['rules'] = { |
|
|
|
accountClusterRisk: |
|
|
|
summary.activityCount > 0 |
|
|
|
? await this.rulesService.evaluate( |
|
|
@ -1313,7 +1313,7 @@ export class PortfolioService { |
|
|
|
}; |
|
|
|
|
|
|
|
return { |
|
|
|
'x-ray': { |
|
|
|
xRay: { |
|
|
|
rules, |
|
|
|
statistics: this.getReportStatistics(rules) |
|
|
|
} |
|
|
@ -1737,8 +1737,8 @@ export class PortfolioService { |
|
|
|
} |
|
|
|
|
|
|
|
private getReportStatistics( |
|
|
|
evaluatedRules: PortfolioReportResponse['x-ray']['rules'] |
|
|
|
): PortfolioReportResponse['x-ray']['statistics'] { |
|
|
|
evaluatedRules: PortfolioReportResponse['xRay']['rules'] |
|
|
|
): PortfolioReportResponse['xRay']['statistics'] { |
|
|
|
const rulesActiveCount = Object.values(evaluatedRules) |
|
|
|
.flat() |
|
|
|
.filter((rule) => { |
|
|
|
|
|
@ -47,7 +47,7 @@ export class GfXRayPageComponent { |
|
|
|
public inactiveRules: PortfolioReportRule[]; |
|
|
|
public isLoading = false; |
|
|
|
public regionalMarketClusterRiskRules: PortfolioReportRule[]; |
|
|
|
public statistics: PortfolioReportResponse['x-ray']['statistics']; |
|
|
|
public statistics: PortfolioReportResponse['xRay']['statistics']; |
|
|
|
public user: User; |
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
@ -115,7 +115,7 @@ export class GfXRayPageComponent { |
|
|
|
this.dataService |
|
|
|
.fetchPortfolioReport() |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe(({ 'x-ray': { rules, statistics } }) => { |
|
|
|
.subscribe(({ xRay: { rules, statistics } }) => { |
|
|
|
this.inactiveRules = this.mergeInactiveRules(rules); |
|
|
|
this.statistics = statistics; |
|
|
|
|
|
|
@ -161,7 +161,7 @@ export class GfXRayPageComponent { |
|
|
|
} |
|
|
|
|
|
|
|
private mergeInactiveRules( |
|
|
|
rules: PortfolioReportResponse['x-ray']['rules'] |
|
|
|
rules: PortfolioReportResponse['xRay']['rules'] |
|
|
|
): PortfolioReportRule[] { |
|
|
|
let inactiveRules: PortfolioReportRule[] = []; |
|
|
|
|
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import { PortfolioReportRule } from '../portfolio-report-rule.interface'; |
|
|
|
|
|
|
|
export interface PortfolioReportResponse { |
|
|
|
'x-ray': { |
|
|
|
xRay: { |
|
|
|
rules: { [group: string]: PortfolioReportRule[] }; |
|
|
|
statistics: { |
|
|
|
rulesActiveCount: number; |
|
|
|