From 23e155b307774726bf93c622dccf2c8f0c9aee7d Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:54:11 +0200 Subject: [PATCH] Reuse interface --- .../rules/account-cluster-risk/current-investment.ts | 9 +++++---- .../rules/account-cluster-risk/initial-investment.ts | 9 +++++---- .../models/rules/account-cluster-risk/single-account.ts | 5 ++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts index 74a7c80b0..bff51aabe 100644 --- a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts +++ b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts @@ -1,16 +1,17 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface'; import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { PortfolioPosition } from '@ghostfolio/common/interfaces'; +import { + PortfolioDetails, + PortfolioPosition +} from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; export class AccountClusterRiskCurrentInvestment extends Rule { public constructor( protected exchangeRateDataService: ExchangeRateDataService, - private accounts: { - [account: string]: { current: number; original: number }; - } + private accounts: PortfolioDetails['accounts'] ) { super(exchangeRateDataService, { name: 'Current Investment' diff --git a/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts b/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts index 3f5f6c854..13da575dd 100644 --- a/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts +++ b/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts @@ -1,6 +1,9 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface'; -import { PortfolioPosition } from '@ghostfolio/common/interfaces'; +import { + PortfolioDetails, + PortfolioPosition +} from '@ghostfolio/common/interfaces'; import { ExchangeRateDataService } from 'apps/api/src/services/exchange-rate-data.service'; import { Rule } from '../../rule'; @@ -8,9 +11,7 @@ import { Rule } from '../../rule'; export class AccountClusterRiskInitialInvestment extends Rule { public constructor( protected exchangeRateDataService: ExchangeRateDataService, - private accounts: { - [account: string]: { current: number; original: number }; - } + private accounts: PortfolioDetails['accounts'] ) { super(exchangeRateDataService, { name: 'Initial Investment' diff --git a/apps/api/src/models/rules/account-cluster-risk/single-account.ts b/apps/api/src/models/rules/account-cluster-risk/single-account.ts index 6132a65f5..90d93c1e3 100644 --- a/apps/api/src/models/rules/account-cluster-risk/single-account.ts +++ b/apps/api/src/models/rules/account-cluster-risk/single-account.ts @@ -1,5 +1,6 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface'; +import { PortfolioDetails } from '@ghostfolio/common/interfaces'; import { ExchangeRateDataService } from 'apps/api/src/services/exchange-rate-data.service'; import { Rule } from '../../rule'; @@ -7,9 +8,7 @@ import { Rule } from '../../rule'; export class AccountClusterRiskSingleAccount extends Rule { public constructor( protected exchangeRateDataService: ExchangeRateDataService, - private accounts: { - [account: string]: { current: number; original: number }; - } + private accounts: PortfolioDetails['accounts'] ) { super(exchangeRateDataService, { name: 'Single Account'