Browse Source

Refactoring

pull/7251/head
Thomas Kaul 4 weeks ago
parent
commit
b052384cf2
  1. 6
      apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts
  2. 2
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  3. 9
      libs/common/src/lib/dtos/create-asset-profile-split.dto.ts
  4. 5
      prisma/schema.prisma

6
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
);
}

2
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,

9
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)

5
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 {

Loading…
Cancel
Save