From 0830a2e8147de3edb41445d497c3c59e40da5d5a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 1 Oct 2026 16:38:34 +0200 Subject: [PATCH] Remove symbol profile relation from activities --- .../app/activities/activities.controller.ts | 19 +++++++++++++---- apps/api/src/helper/object.helper.spec.ts | 21 +++++++++++++++++++ libs/common/src/lib/config.ts | 10 +++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/apps/api/src/app/activities/activities.controller.ts b/apps/api/src/app/activities/activities.controller.ts index 512f2e98f6..36a9c76fa4 100644 --- a/apps/api/src/app/activities/activities.controller.ts +++ b/apps/api/src/app/activities/activities.controller.ts @@ -33,10 +33,9 @@ import { Query, UseInterceptors } from '@nestjs/common'; -import { Order, Prisma } from '@prisma/client'; +import { Order, SymbolProfile } from '@prisma/client'; import { parseISO } from 'date-fns'; import { StatusCodes, getReasonPhrase } from 'http-status-codes'; -import { omit } from 'lodash-es'; import { ActivitiesFilterDto } from './activities-filter.dto'; import { ActivitiesService } from './activities.service'; @@ -218,7 +217,16 @@ export class ActivitiesController { userId, userSubscription }: ImpersonationContext - ): Promise> { + ): Promise< + Order & { + assetProfile: SymbolProfile; + + /** + * @deprecated Use `assetProfile` instead + */ + SymbolProfile: SymbolProfile; + } + > { // Evaluate the more restrictive subscription of the authenticated user // and the owner of the activity const subscription = @@ -304,7 +312,10 @@ export class ActivitiesController { }); } - return omit(activity, ['SymbolProfile']); + return { + ...activity, + assetProfile: activity.SymbolProfile + }; } @HasPermission(permissions.updateActivity) diff --git a/apps/api/src/helper/object.helper.spec.ts b/apps/api/src/helper/object.helper.spec.ts index ca487ed8f7..c8422ea05f 100644 --- a/apps/api/src/helper/object.helper.spec.ts +++ b/apps/api/src/helper/object.helper.spec.ts @@ -3082,6 +3082,20 @@ describe('redactAttributes', () => { feeInBaseCurrency: 18.2, id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', quantity: 50, + // The relation of the database is part of the response next to the + // asset profile + SymbolProfile: { + comment: 'Reviewed by the administrator', + name: 'Apple Inc', + scraperConfiguration: { + headers: { Authorization: 'Bearer TOKEN' }, + mode: 'lazy', + selector: '.price', + url: 'https://example.org/get_price' + }, + symbol: 'AAPL', + symbolMapping: { YAHOO: 'AAPL' } + }, type: 'BUY', unitPrice: 220.79, value: 11039.5, @@ -3111,6 +3125,13 @@ describe('redactAttributes', () => { feeInBaseCurrency: null, id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', quantity: null, + SymbolProfile: { + comment: null, + name: 'Apple Inc', + scraperConfiguration: null, + symbol: 'AAPL', + symbolMapping: null + }, type: 'BUY', // A price per unit stays visible, like the average price and the market // price of a holding diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index 6ff492f671..73bf5cc00c 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -180,6 +180,16 @@ export const DEFAULT_REDACTED_PATHS = [ 'settings.emergencyFund', 'settings.projectedTotalAmount', 'settings.savingsRate', + + /* @deprecated */ + 'SymbolProfile.comment', + + /* @deprecated */ + 'SymbolProfile.scraperConfiguration', + + /* @deprecated */ + 'SymbolProfile.symbolMapping', + 'totalBalanceInBaseCurrency', 'totalDividendInBaseCurrency', 'totalInterestInBaseCurrency',