From b052384cf2091fad2db68a273262f536fb8587a6 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 2 Aug 2026 16:24:23 +0200 Subject: [PATCH] Refactoring --- .../asset-profiles/asset-profiles.controller.ts | 6 ++++-- .../asset-profile-dialog.component.ts | 2 ++ .../src/lib/dtos/create-asset-profile-split.dto.ts | 9 ++++++--- prisma/schema.prisma | 5 ++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts index dd050f6d03..6521665e1b 100644 --- a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts +++ b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts @@ -222,8 +222,10 @@ export class AssetProfilesController { if (!canAccessAllAssetProfiles && !canAccessOwnAssetProfile) { throw new HttpException( - getReasonPhrase(StatusCodes.FORBIDDEN), - StatusCodes.FORBIDDEN + assetProfile.userId + ? getReasonPhrase(StatusCodes.NOT_FOUND) + : getReasonPhrase(StatusCodes.FORBIDDEN), + assetProfile.userId ? StatusCodes.NOT_FOUND : StatusCodes.FORBIDDEN ); } diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts index 7e91696c0c..f0e8eaf171 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts @@ -39,6 +39,7 @@ import { GfSymbolAutocompleteComponent } from '@ghostfolio/ui/symbol-autocomplet import { GfValueComponent } from '@ghostfolio/ui/value'; import { TextFieldModule } from '@angular/cdk/text-field'; +import { CommonModule } from '@angular/common'; import { HttpErrorResponse } from '@angular/common/http'; import { ChangeDetectionStrategy, @@ -112,6 +113,7 @@ import { AssetProfileDialogParams } from './interfaces/interfaces'; changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'd-flex flex-column h-100' }, imports: [ + CommonModule, FormsModule, GfCurrencySelectorComponent, GfEntityLogoComponent, diff --git a/libs/common/src/lib/dtos/create-asset-profile-split.dto.ts b/libs/common/src/lib/dtos/create-asset-profile-split.dto.ts index 244b5affcb..a68f00883c 100644 --- a/libs/common/src/lib/dtos/create-asset-profile-split.dto.ts +++ b/libs/common/src/lib/dtos/create-asset-profile-split.dto.ts @@ -26,9 +26,12 @@ export class CreateAssetProfileSplitDto { * The resulting split factor is numerator / denominator. Both parts are kept * so that the ratio stays exact, for example 1/3 for a 1:3 reverse split. * - * Only the quantity of activities is adjusted by this ratio. Market data is - * already split-adjusted by the data providers and must not be adjusted - * again. + * Activities are adjusted by this ratio: the quantity is multiplied by it and + * the unit price divided by it, so that the total value of an activity stays + * the same. + * + * Market data is already split-adjusted by the data providers and must not be + * adjusted again. */ @IsInt() @Validate(IsSplitRatioConstraint) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 45920b82cd..77faccd492 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -123,7 +123,10 @@ model AssetProfileResolution { /// The ratio is stored as two integers instead of the resulting factor, so that /// it stays exact, for example 1/3 for a 1:3 reverse split. /// -/// Only the quantity of activities before the date is adjusted by the ratio. +/// Activities before the date are adjusted by the ratio: the quantity is +/// multiplied by it and the unit price divided by it, so that the total value +/// of an activity stays the same. +/// /// Market data is already split-adjusted by the data providers and must not be /// adjusted again. model AssetProfileSplit {