Browse Source

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

* Fix base currency

* Update changelog
pull/7156/head^2
Thomas Kaul 2 days ago
committed by GitHub
parent
commit
6dac46dcdc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 7
      apps/api/src/app/endpoints/public/public.controller.ts

1
CHANGELOG.md

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### 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 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` - Fixed the time zone handling in the `api` test suite for deterministic execution in `UTC`

7
apps/api/src/app/endpoints/public/public.controller.ts

@ -13,17 +13,14 @@ import {
AccessSettings, AccessSettings,
PublicPortfolioResponse PublicPortfolioResponse
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import type { RequestWithUser } from '@ghostfolio/common/types';
import { import {
Controller, Controller,
Get, Get,
HttpException, HttpException,
Inject,
Param, Param,
UseInterceptors UseInterceptors
} from '@nestjs/common'; } from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { import {
AssetClass, AssetClass,
AssetSubClass, AssetSubClass,
@ -40,7 +37,6 @@ export class PublicController {
private readonly configurationService: ConfigurationService, private readonly configurationService: ConfigurationService,
private readonly exchangeRateDataService: ExchangeRateDataService, private readonly exchangeRateDataService: ExchangeRateDataService,
private readonly portfolioService: PortfolioService, private readonly portfolioService: PortfolioService,
@Inject(REQUEST) private readonly request: RequestWithUser,
private readonly userService: UserService private readonly userService: UserService
) {} ) {}
@ -168,8 +164,7 @@ export class PublicController {
this.exchangeRateDataService.toCurrency( this.exchangeRateDataService.toCurrency(
quantity * marketPrice, quantity * marketPrice,
assetProfile.currency, assetProfile.currency,
this.request.user?.settings?.settings.baseCurrency ?? user.settings?.settings.baseCurrency ?? DEFAULT_CURRENCY
DEFAULT_CURRENCY
) )
); );
}) })

Loading…
Cancel
Save