From dd15bba3595444e4d91461c65dabfa68ffc37b48 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:00:20 +0200 Subject: [PATCH] Bugfix/fix public page for non existent access (#3604) * Handle non-existent access * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/portfolio/portfolio.controller.ts | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bcb87a7..2bc6e3d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `angular` from version `18.0.4` to `18.1.1` - Upgraded `Nx` from version `19.4.3` to `19.5.1` +### Fixed + +- Fixed an issue in the public page related to a non-existent access + ## 2.97.0 - 2024-07-20 ### Added diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 19f48fa8..84d4ef53 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -496,9 +496,6 @@ export class PortfolioController { @Param('accessId') accessId ): Promise { const access = await this.accessService.access({ id: accessId }); - const user = await this.userService.user({ - id: access.userId - }); if (!access) { throw new HttpException( @@ -508,6 +505,11 @@ export class PortfolioController { } let hasDetails = true; + + const user = await this.userService.user({ + id: access.userId + }); + if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { hasDetails = user.subscription.type === 'Premium'; }