Browse Source

Bugfix/value redaction in latest activities of public portfolio page (#7747)

* Fix value redaction

* Update changelog
pull/7741/head
Thomas Kaul 15 hours ago
committed by GitHub
parent
commit
25cacf95bb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 71
      apps/api/src/app/endpoints/public/public.service.ts
  3. 1
      apps/api/src/interceptors/transform-data-source-in-response/transform-data-source-in-response.interceptor.ts
  4. 4
      libs/common/src/lib/config.ts
  5. 5
      libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed the redaction of `fee`, `quantity`, `value` and `valueInBaseCurrency` in the latest activities of the public page (experimental)
## 3.63.0 - 2026-08-28 ## 3.63.0 - 2026-08-28
### Added ### Added

71
apps/api/src/app/endpoints/public/public.service.ts

@ -81,25 +81,34 @@ export class PublicService {
}) })
]); ]);
const { activities } = await this.activitiesService.getActivities({
filters,
sortColumn: 'date',
sortDirection: 'desc',
take: 10,
types: [ActivityType.BUY, ActivityType.SELL],
userCurrency: user?.settings?.settings.baseCurrency ?? DEFAULT_CURRENCY,
userId: user.id,
withExcludedAccountsAndActivities: false
});
// Experimental // Experimental
const latestActivities = this.configurationService.get( let latestActivities: PublicPortfolioResponse['latestActivities'] = [];
'ENABLE_FEATURE_SUBSCRIPTION'
) if (!this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
? [] const { activities } = await this.activitiesService.getActivities({
: activities.map( filters,
({ sortColumn: 'date',
assetProfile, sortDirection: 'desc',
take: 10,
types: [ActivityType.BUY, ActivityType.SELL],
userCurrency: user?.settings?.settings.baseCurrency ?? DEFAULT_CURRENCY,
userId: user.id,
withExcludedAccountsAndActivities: false
});
latestActivities = activities.map(
({
assetProfile,
currency,
date,
fee,
quantity,
type,
unitPrice,
value,
valueInBaseCurrency
}) => {
return {
currency, currency,
date, date,
fee, fee,
@ -107,21 +116,17 @@ export class PublicService {
type, type,
unitPrice, unitPrice,
value, value,
valueInBaseCurrency valueInBaseCurrency,
}) => { assetProfile: {
return { currency: assetProfile.currency,
assetProfile, dataSource: assetProfile.dataSource,
currency, name: assetProfile.name,
date, symbol: assetProfile.symbol
fee, }
quantity, };
type, }
unitPrice, );
value, }
valueInBaseCurrency
};
}
);
Object.values(markets ?? {}).forEach((market) => { Object.values(markets ?? {}).forEach((market) => {
delete market.valueInBaseCurrency; delete market.valueInBaseCurrency;

1
apps/api/src/interceptors/transform-data-source-in-response/transform-data-source-in-response.interceptor.ts

@ -89,6 +89,7 @@ export class TransformDataSourceInResponseInterceptor<
'holdings[*].assetProfile.dataSource', 'holdings[*].assetProfile.dataSource',
'holdings[*].dataSource', 'holdings[*].dataSource',
'items[*].dataSource', 'items[*].dataSource',
'latestActivities[*].assetProfile.dataSource',
'settings["filters.dataSource"]', 'settings["filters.dataSource"]',
'watchlist[*].dataSource' 'watchlist[*].dataSource'
] ]

4
libs/common/src/lib/config.ts

@ -157,6 +157,10 @@ export const DEFAULT_REDACTED_PATHS = [
'holdings[*].valueInBaseCurrency', 'holdings[*].valueInBaseCurrency',
'interestInBaseCurrency', 'interestInBaseCurrency',
'investmentInBaseCurrencyWithCurrencyEffect', 'investmentInBaseCurrencyWithCurrencyEffect',
'latestActivities[*].fee',
'latestActivities[*].quantity',
'latestActivities[*].value',
'latestActivities[*].valueInBaseCurrency',
'netPerformance', 'netPerformance',
'netPerformanceWithCurrencyEffect', 'netPerformanceWithCurrencyEffect',
'platforms[*].balance', 'platforms[*].balance',

5
libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts

@ -24,7 +24,10 @@ export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 {
Order, Order,
'currency' | 'date' | 'fee' | 'quantity' | 'type' | 'unitPrice' 'currency' | 'date' | 'fee' | 'quantity' | 'type' | 'unitPrice'
> & { > & {
assetProfile?: EnhancedAssetProfile; assetProfile: Pick<
EnhancedAssetProfile,
'currency' | 'dataSource' | 'name' | 'symbol'
>;
value: number; value: number;
valueInBaseCurrency: number; valueInBaseCurrency: number;
})[]; })[];

Loading…
Cancel
Save