From 71b375ea92706bde6fba83bdb9e62d13104041f1 Mon Sep 17 00:00:00 2001 From: Google <53668973+GooglyBlox@users.noreply.github.com> Date: Sat, 18 Oct 2025 01:14:24 -0700 Subject: [PATCH] Task/refactor BenchmarkMarketDataDetails to BenchmarkMarketDataDetailsResponse (#5771) * Refactor BenchmarkMarketDataDetails to BenchmarkMarketDataDetailsResponse --- .../src/app/endpoints/benchmarks/benchmarks.controller.ts | 4 ++-- apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts | 4 ++-- apps/client/src/app/services/data.service.ts | 6 +++--- libs/common/src/lib/interfaces/index.ts | 4 ++-- .../benchmark-market-data-details-response.interface.ts} | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename libs/common/src/lib/interfaces/{benchmark-market-data-details.interface.ts => responses/benchmark-market-data-details-response.interface.ts} (64%) diff --git a/apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts b/apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts index 69383a30d..629d90928 100644 --- a/apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts +++ b/apps/api/src/app/endpoints/benchmarks/benchmarks.controller.ts @@ -8,7 +8,7 @@ import { getIntervalFromDateRange } from '@ghostfolio/common/calculation-helper' import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import type { AssetProfileIdentifier, - BenchmarkMarketDataDetails, + BenchmarkMarketDataDetailsResponse, BenchmarkResponse } from '@ghostfolio/common/interfaces'; import { permissions } from '@ghostfolio/common/permissions'; @@ -125,7 +125,7 @@ export class BenchmarksController { @Query('symbol') filterBySymbol?: string, @Query('tags') filterByTags?: string, @Query('withExcludedAccounts') withExcludedAccountsParam = 'false' - ): Promise { + ): Promise { const { endDate, startDate } = getIntervalFromDateRange( dateRange, new Date(startDateString) diff --git a/apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts b/apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts index aa53564b7..03ff32c21 100644 --- a/apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts +++ b/apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts @@ -6,7 +6,7 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data/market-d import { DATE_FORMAT, parseDate, resetHours } from '@ghostfolio/common/helper'; import { AssetProfileIdentifier, - BenchmarkMarketDataDetails, + BenchmarkMarketDataDetailsResponse, Filter } from '@ghostfolio/common/interfaces'; import { DateRange, UserWithSettings } from '@ghostfolio/common/types'; @@ -43,7 +43,7 @@ export class BenchmarksService { startDate: Date; user: UserWithSettings; withExcludedAccounts?: boolean; - } & AssetProfileIdentifier): Promise { + } & AssetProfileIdentifier): Promise { const marketData: { date: string; value: number }[] = []; const userCurrency = user.settings.settings.baseCurrency; const userId = user.id; diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index b5f6d9e01..3cb5a8c75 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -30,7 +30,7 @@ import { AiPromptResponse, ApiKeyResponse, AssetProfileIdentifier, - BenchmarkMarketDataDetails, + BenchmarkMarketDataDetailsResponse, BenchmarkResponse, DataProviderHealthResponse, Export, @@ -368,7 +368,7 @@ export class DataService { range: DateRange; startDate: Date; withExcludedAccounts?: boolean; - } & AssetProfileIdentifier): Observable { + } & AssetProfileIdentifier) { let params = this.buildFiltersAsQueryParams({ filters }); params = params.append('range', range); @@ -377,7 +377,7 @@ export class DataService { params = params.append('withExcludedAccounts', withExcludedAccounts); } - return this.http.get( + return this.http.get( `/api/v1/benchmarks/${dataSource}/${symbol}/${format(startDate, DATE_FORMAT, { in: utc })}`, { params } ); diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index 8a7ef8544..578d9cec8 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -10,7 +10,6 @@ import type { import type { AdminUsers } from './admin-users.interface'; import type { AssetClassSelectorOption } from './asset-class-selector-option.interface'; import type { AssetProfileIdentifier } from './asset-profile-identifier.interface'; -import type { BenchmarkMarketDataDetails } from './benchmark-market-data-details.interface'; import type { BenchmarkProperty } from './benchmark-property.interface'; import type { Benchmark } from './benchmark.interface'; import type { Coupon } from './coupon.interface'; @@ -41,6 +40,7 @@ import type { AccountBalancesResponse } from './responses/account-balances-respo import type { AccountsResponse } from './responses/accounts-response.interface'; import type { AiPromptResponse } from './responses/ai-prompt-response.interface'; import type { ApiKeyResponse } from './responses/api-key-response.interface'; +import type { BenchmarkMarketDataDetailsResponse } from './responses/benchmark-market-data-details-response.interface'; import type { BenchmarkResponse } from './responses/benchmark-response.interface'; import type { DataEnhancerHealthResponse } from './responses/data-enhancer-health-response.interface'; import type { DataProviderGhostfolioAssetProfileResponse } from './responses/data-provider-ghostfolio-asset-profile-response.interface'; @@ -91,7 +91,7 @@ export { AssetClassSelectorOption, AssetProfileIdentifier, Benchmark, - BenchmarkMarketDataDetails, + BenchmarkMarketDataDetailsResponse, BenchmarkProperty, BenchmarkResponse, Coupon, diff --git a/libs/common/src/lib/interfaces/benchmark-market-data-details.interface.ts b/libs/common/src/lib/interfaces/responses/benchmark-market-data-details-response.interface.ts similarity index 64% rename from libs/common/src/lib/interfaces/benchmark-market-data-details.interface.ts rename to libs/common/src/lib/interfaces/responses/benchmark-market-data-details-response.interface.ts index ed693b9af..cdd63ff79 100644 --- a/libs/common/src/lib/interfaces/benchmark-market-data-details.interface.ts +++ b/libs/common/src/lib/interfaces/responses/benchmark-market-data-details-response.interface.ts @@ -1,5 +1,5 @@ import { LineChartItem } from '@ghostfolio/common/interfaces'; -export interface BenchmarkMarketDataDetails { +export interface BenchmarkMarketDataDetailsResponse { marketData: LineChartItem[]; }