From c37ad9bad4af3200c3cb589afd428bfdb7983a35 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:15:41 +0100 Subject: [PATCH] Bugfix/fix activities import (#3095) * Fix query parameter handling of booleans * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/import/import.controller.ts | 4 +++- apps/api/src/app/portfolio/portfolio.controller.ts | 7 +++++-- apps/api/src/app/symbol/symbol.controller.ts | 4 +++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51d86efa1..dbe4e13d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Optimized the calculation of the portfolio summary +### Fixed + +- Fixed the the activities import (query parameter handling) + ## 2.60.0 - 2024-03-02 ### Added diff --git a/apps/api/src/app/import/import.controller.ts b/apps/api/src/app/import/import.controller.ts index b7aff8634..29a06fc9f 100644 --- a/apps/api/src/app/import/import.controller.ts +++ b/apps/api/src/app/import/import.controller.ts @@ -43,8 +43,10 @@ export class ImportController { @UseInterceptors(TransformDataSourceInResponseInterceptor) public async import( @Body() importData: ImportDataDto, - @Query('dryRun') isDryRun = false + @Query('dryRun') isDryRunParam = 'false' ): Promise { + const isDryRun = isDryRunParam === 'true'; + if ( !hasPermission(this.request.user.permissions, permissions.createAccount) ) { diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 8f4acc060..e51321561 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -342,9 +342,12 @@ export class PortfolioController { @Query('assetClasses') filterByAssetClasses?: string, @Query('range') dateRange: DateRange = 'max', @Query('tags') filterByTags?: string, - @Query('withExcludedAccounts') withExcludedAccounts = false, - @Query('withItems') withItems = false + @Query('withExcludedAccounts') withExcludedAccountsParam = 'false', + @Query('withItems') withItemsParam = 'false' ): Promise { + const withExcludedAccounts = withExcludedAccountsParam === 'true'; + const withItems = withItemsParam === 'true'; + const hasReadRestrictedAccessPermission = this.userService.hasReadRestrictedAccessPermission({ impersonationId, diff --git a/apps/api/src/app/symbol/symbol.controller.ts b/apps/api/src/app/symbol/symbol.controller.ts index e41267b79..17e0056d6 100644 --- a/apps/api/src/app/symbol/symbol.controller.ts +++ b/apps/api/src/app/symbol/symbol.controller.ts @@ -39,9 +39,11 @@ export class SymbolController { @UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseInterceptors(TransformDataSourceInResponseInterceptor) public async lookupSymbol( - @Query('includeIndices') includeIndices = false, + @Query('includeIndices') includeIndicesParam = 'false', @Query('query') query = '' ): Promise<{ items: LookupItem[] }> { + const includeIndices = includeIndicesParam === 'true'; + try { return this.symbolService.lookup({ includeIndices,