From 73cd2f9cb7192564f8ff2bbd60b1f2737f614090 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:27:33 +0200 Subject: [PATCH] Bugfix/fix exception in portfolio details endpoint (#3896) * Fix exception caused by markets and marketsAdvanced * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/endpoints/public/public.controller.ts | 2 +- apps/api/src/app/portfolio/portfolio.controller.ts | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 752fc2397..58dd3fdbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved the tags from the info to the user service - Switched the `prefer-const` rule from `warn` to `error` in the `eslint` configuration +### Fixed + +- Fixed an exception in the portfolio details endpoint caused by a calculation of the allocations by market + ## 2.113.0 - 2024-10-06 ### Added diff --git a/apps/api/src/app/endpoints/public/public.controller.ts b/apps/api/src/app/endpoints/public/public.controller.ts index 9399f97bf..7488e4201 100644 --- a/apps/api/src/app/endpoints/public/public.controller.ts +++ b/apps/api/src/app/endpoints/public/public.controller.ts @@ -76,7 +76,7 @@ export class PublicController { }) ]); - Object.values(markets).forEach((market) => { + Object.values(markets ?? {}).forEach((market) => { delete market.valueInBaseCurrency; }); diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index ff0c31060..326dda151 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -172,10 +172,10 @@ export class PortfolioController { }) || isRestrictedView(this.request.user) ) { - Object.values(markets).forEach((market) => { + Object.values(markets ?? {}).forEach((market) => { delete market.valueInBaseCurrency; }); - Object.values(marketsAdvanced).forEach((market) => { + Object.values(marketsAdvanced ?? {}).forEach((market) => { delete market.valueInBaseCurrency; });