From 35f98b9d2dda5d673baab7dd7e4dd85d362b95f7 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 5 Nov 2023 09:57:23 +0100 Subject: [PATCH] Bugfix/handle failing database query for account find many (#2598) * Handle issue with account.findMany() -> where: { id: { in: [ null ] } } * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/portfolio/portfolio.service.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dda1eb076..226951313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Loosened the validation in the activities import (expects values greater than or equal to 0 for `fee`, `quantity` and `unitPrice`) +- Handled an issue with a failing database query (`account.findMany()`) related to activities without account ## 2.17.0 - 2023-11-02 diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index b2538fb6a..525273253 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -1892,9 +1892,13 @@ export class PortfolioService { }); } else { const accountIds = uniq( - orders.map(({ accountId }) => { - return accountId; - }) + orders + .filter(({ accountId }) => { + return accountId; + }) + .map(({ accountId }) => { + return accountId; + }) ); currentAccounts = await this.accountService.accounts({