Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/add key to x ray rule (#3248)
Thomas Kaulb51255a543e5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bf0eeb0fd0..932206f907 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Added support to override the url of an asset profile in the asset profile details dialog of the admin control- Added the asset profile icon to the asset profile details dialog of the admin control- Added the platform icon to the create or update platform dialog of the admin control+- Extended the rules in the _X-ray_ section by a `key`- Extended the content of the _Self-Hosting_ section by the data providers on the Frequently Asked Questions (FAQ) page### Changeddiff --git a/apps/api/src/app/portfolio/rules.service.ts b/apps/api/src/app/portfolio/rules.service.tsindex 7dfcee56a0..85f7ed55b9 100644--- a/apps/api/src/app/portfolio/rules.service.ts+++ b/apps/api/src/app/portfolio/rules.service.ts@@ -17,8 +17,16 @@ export class RulesService {return rule.getSettings(aUserSettings)?.isActive;}).map((rule) => {- const evaluationResult = rule.evaluate(rule.getSettings(aUserSettings));- return { ...evaluationResult, name: rule.getName() };+ const { evaluation, value } = rule.evaluate(+ rule.getSettings(aUserSettings)+ );++ return {+ evaluation,+ value,+ key: rule.getKey(),+ name: rule.getName()+ };});}}diff --git a/apps/api/src/models/rule.ts b/apps/api/src/models/rule.tsindex 171da810de..ba37f4e94c 100644--- a/apps/api/src/models/rule.ts+++ b/apps/api/src/models/rule.ts@@ -7,19 +7,27 @@ import { EvaluationResult } from './interfaces/evaluation-result.interface';import { RuleInterface } from './interfaces/rule.interface';export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {+ private key: string;private name: string;public constructor(protected exchangeRateDataService: ExchangeRateDataService,{+ key,name}: {+ key: string;name: string;}) {+ this.key = key;this.name = name;}+ public getKey() {+ return this.key;+ }+public getName() {return this.name;}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.tsindex 52f20a218d..a9a60f912b 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@@ -15,6 +15,7 @@ export class AccountClusterRiskCurrentInvestment extends Rule<Settings> {accounts: PortfolioDetails['accounts']) {super(exchangeRateDataService, {+ key: AccountClusterRiskCurrentInvestment.name,name: '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.tsindex b5028228a2..a47895c132 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@@ -11,6 +11,7 @@ export class AccountClusterRiskSingleAccount extends Rule<RuleSettings> {accounts: PortfolioDetails['accounts']) {super(exchangeRateDataService, {+ key: AccountClusterRiskSingleAccount.name,name: 'Single Account'});diff --git a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.tsindex a2bd44f446..39406e6c2a 100644--- a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts+++ b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts@@ -11,6 +11,7 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Settipositions: TimelinePosition[]) {super(exchangeRateDataService, {+ key: CurrencyClusterRiskBaseCurrencyCurrentInvestment.name,name: 'Investment: Base Currency'});diff --git a/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/current-investment.tsindex 51e9d01d8a..078aaba9b0 100644--- a/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts+++ b/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts@@ -11,6 +11,7 @@ export class CurrencyClusterRiskCurrentInvestment extends Rule<Settings> {positions: TimelinePosition[]) {super(exchangeRateDataService, {+ key: CurrencyClusterRiskCurrentInvestment.name,name: 'Investment'});diff --git a/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts b/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.tsindex b6248ab514..20e9502bfc 100644--- a/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts+++ b/apps/api/src/models/rules/emergency-fund/emergency-fund-setup.ts@@ -11,6 +11,7 @@ export class EmergencyFundSetup extends Rule<Settings> {emergencyFund: number) {super(exchangeRateDataService, {+ key: EmergencyFundSetup.name,name: 'Emergency Fund: Set up'});diff --git a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.tsindex 0ba70d23c2..69db9634dc 100644--- a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts+++ b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts@@ -13,6 +13,7 @@ export class FeeRatioInitialInvestment extends Rule<Settings> {fees: number) {super(exchangeRateDataService, {+ key: FeeRatioInitialInvestment.name,name: 'Fee Ratio'});