Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/base currency for total value calculation in public controller (#7157)

Thomas Kaul6dac46dcdc5f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 199b0b3838..8af2fe3d8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- Fixed the base currency for the total value calculation in the public access for portfolio sharing
- Fixed an issue in the public access for portfolio sharing that exposed absolute values of the top holdings of ETFs
- Fixed the time zone handling in the `api` test suite for deterministic execution in `UTC`
diff --git a/apps/api/src/app/endpoints/public/public.controller.ts b/apps/api/src/app/endpoints/public/public.controller.ts
index d0e459f01d..d06e3b5fe2 100644
--- a/apps/api/src/app/endpoints/public/public.controller.ts
+++ b/apps/api/src/app/endpoints/public/public.controller.ts
@@ -13,17 +13,14 @@ import {
AccessSettings,
PublicPortfolioResponse
} from '@ghostfolio/common/interfaces';
-import type { RequestWithUser } from '@ghostfolio/common/types';
import {
Controller,
Get,
HttpException,
- Inject,
Param,
UseInterceptors
} from '@nestjs/common';
-import { REQUEST } from '@nestjs/core';
import {
AssetClass,
AssetSubClass,
@@ -40,7 +37,6 @@ export class PublicController {
private readonly configurationService: ConfigurationService,
private readonly exchangeRateDataService: ExchangeRateDataService,
private readonly portfolioService: PortfolioService,
- @Inject(REQUEST) private readonly request: RequestWithUser,
private readonly userService: UserService
) {}
@@ -168,8 +164,7 @@ export class PublicController {
this.exchangeRateDataService.toCurrency(
quantity * marketPrice,
assetProfile.currency,
- this.request.user?.settings?.settings.baseCurrency ??
- DEFAULT_CURRENCY
+ user.settings?.settings.baseCurrency ?? DEFAULT_CURRENCY
)
);
})