From 1eb1753ce795a97c29fa4826231be2764da1a076 Mon Sep 17 00:00:00 2001 From: AkashNegi1 Date: Sat, 20 Jun 2026 18:52:58 +0530 Subject: [PATCH] Address review feedback for #7079 --- CHANGELOG.md | 1 + apps/api/src/app/asset/asset.controller.ts | 2 +- apps/api/src/app/asset/asset.module.ts | 2 +- .../asset-profiles/asset-profiles.controller.ts | 12 ++++++------ .../asset-profiles/asset-profiles.module.ts | 4 ++-- .../asset-profiles/asset-profiles.service.ts | 4 ++-- libs/common/src/lib/interfaces/index.ts | 4 ++-- ...erface.ts => asset-profile-response.interface.ts} | 2 +- libs/ui/src/lib/services/data.service.ts | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) rename libs/common/src/lib/interfaces/responses/{market-data-details-response.interface.ts => asset-profile-response.interface.ts} (81%) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb67cd23b..391bba054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Moved the endpoint to get the asset profile details from `GET api/v1/market-data/:dataSource/:symbol` to `GET api/v1/asset-profiles/:dataSource/:symbol` - Moved the endpoint to get the asset profiles from `GET api/v1/admin/market-data` to `GET api/v1/asset-profiles` - Added the selected asset profile count to the delete menu item of the historical market data table in the admin control panel - Added the selected asset profile count to the deletion confirmation dialog of the historical market data table in the admin control panel diff --git a/apps/api/src/app/asset/asset.controller.ts b/apps/api/src/app/asset/asset.controller.ts index 575916b38..de04b5c81 100644 --- a/apps/api/src/app/asset/asset.controller.ts +++ b/apps/api/src/app/asset/asset.controller.ts @@ -21,7 +21,7 @@ export class AssetController { @Param('symbol') symbol: string ): Promise { const { assetProfile, marketData } = - await this.assetProfilesService.getMarketDataBySymbol({ + await this.assetProfilesService.getAssetProfile({ dataSource, symbol }); diff --git a/apps/api/src/app/asset/asset.module.ts b/apps/api/src/app/asset/asset.module.ts index 6c3d3ab7c..311c8694f 100644 --- a/apps/api/src/app/asset/asset.module.ts +++ b/apps/api/src/app/asset/asset.module.ts @@ -1,9 +1,9 @@ +import { AssetProfilesModule } from '@ghostfolio/api/app/endpoints/asset-profiles/asset-profiles.module'; import { TransformDataSourceInRequestModule } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.module'; import { TransformDataSourceInResponseModule } from '@ghostfolio/api/interceptors/transform-data-source-in-response/transform-data-source-in-response.module'; import { Module } from '@nestjs/common'; -import { AssetProfilesModule } from '../endpoints/asset-profiles/asset-profiles.module'; import { AssetController } from './asset.controller'; @Module({ 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 620178f0c..fcddb0bc3 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 @@ -6,7 +6,7 @@ import { ApiService } from '@ghostfolio/api/services/api/api.service'; import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { UpdateAssetProfileDataDto } from '@ghostfolio/common/dtos'; import { getCurrencyFromSymbol, isCurrency } from '@ghostfolio/common/helper'; -import { MarketDataDetailsResponse } from '@ghostfolio/common/interfaces'; +import { AssetProfileResponse } from '@ghostfolio/common/interfaces'; import { AssetProfilesResponse, EnhancedSymbolProfile @@ -39,8 +39,8 @@ export class AssetProfilesController { public constructor( private readonly apiService: ApiService, private readonly assetProfilesService: AssetProfilesService, - private readonly symbolProfileService: SymbolProfileService, - @Inject(REQUEST) private readonly request: RequestWithUser + @Inject(REQUEST) private readonly request: RequestWithUser, + private readonly symbolProfileService: SymbolProfileService ) {} @Get() @@ -76,10 +76,10 @@ export class AssetProfilesController { @UseGuards(AuthGuard('jwt')) @UseInterceptors(TransformDataSourceInRequestInterceptor) @UseInterceptors(TransformDataSourceInResponseInterceptor) - public async getAssetProfileMarketData( + public async getAssetProfile( @Param('dataSource') dataSource: DataSource, @Param('symbol') symbol: string - ): Promise { + ): Promise { const [assetProfile] = await this.symbolProfileService.getSymbolProfiles([ { dataSource, symbol } ]); @@ -112,7 +112,7 @@ export class AssetProfilesController { ); } - return this.assetProfilesService.getMarketDataBySymbol({ + return this.assetProfilesService.getAssetProfile({ dataSource, symbol }); diff --git a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.module.ts b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.module.ts index 2c0ef7f8d..f96d92eb3 100644 --- a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.module.ts +++ b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.module.ts @@ -16,6 +16,7 @@ import { AssetProfilesService } from './asset-profiles.service'; @Module({ controllers: [AssetProfilesController], + exports: [AssetProfilesService], imports: [ ActivitiesModule, ApiModule, @@ -28,7 +29,6 @@ import { AssetProfilesService } from './asset-profiles.service'; TransformDataSourceInRequestModule, TransformDataSourceInResponseModule ], - providers: [AssetProfilesService], - exports: [AssetProfilesService] + providers: [AssetProfilesService] }) export class AssetProfilesModule {} diff --git a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts index 43881d33c..cb2903733 100644 --- a/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts +++ b/apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts @@ -31,14 +31,14 @@ export class AssetProfilesService { public constructor( private readonly activitiesService: ActivitiesService, private readonly benchmarkService: BenchmarkService, - private readonly exchangeRateDataService: ExchangeRateDataService, private readonly dataProviderService: DataProviderService, + private readonly exchangeRateDataService: ExchangeRateDataService, private readonly marketDataService: MarketDataService, private readonly prismaService: PrismaService, private readonly symbolProfileService: SymbolProfileService ) {} - public async getMarketDataBySymbol({ + public async getAssetProfile({ dataSource, symbol }: AssetProfileIdentifier): Promise { diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index 989decdba..6777f8ac6 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -47,6 +47,7 @@ import type { AdminUsersResponse } from './responses/admin-users-response.interf import type { AiPromptResponse } from './responses/ai-prompt-response.interface'; import type { AiServiceHealthResponse } from './responses/ai-service-health-response.interface'; import type { ApiKeyResponse } from './responses/api-key-response.interface'; +import type { AssetProfileResponse } from './responses/asset-profile-response.interface'; import type { AssetProfilesResponse } from './responses/asset-profiles-response.interface'; import type { AssetResponse } from './responses/asset-response.interface'; import type { BenchmarkMarketDataDetailsResponse } from './responses/benchmark-market-data-details-response.interface'; @@ -67,7 +68,6 @@ import type { HistoricalResponse } from './responses/historical-response.interfa import type { ImportResponse } from './responses/import-response.interface'; import type { InfoResponse } from './responses/info-response.interface'; import type { LookupResponse } from './responses/lookup-response.interface'; -import type { MarketDataDetailsResponse } from './responses/market-data-details-response.interface'; import type { MarketDataOfMarketsResponse } from './responses/market-data-of-markets-response.interface'; import type { OAuthResponse } from './responses/oauth-response.interface'; import type { PlatformsResponse } from './responses/platforms-response.interface'; @@ -123,6 +123,7 @@ export { AssetClassSelectorOption, AssetProfileIdentifier, AssetProfileItem, + AssetProfileResponse, AssetProfilesResponse, AssetResponse, AttestationCredentialJSON, @@ -158,7 +159,6 @@ export { LookupItem, LookupResponse, MarketData, - MarketDataDetailsResponse, MarketDataOfMarketsResponse, NullableLineChartItem, OAuthResponse, diff --git a/libs/common/src/lib/interfaces/responses/market-data-details-response.interface.ts b/libs/common/src/lib/interfaces/responses/asset-profile-response.interface.ts similarity index 81% rename from libs/common/src/lib/interfaces/responses/market-data-details-response.interface.ts rename to libs/common/src/lib/interfaces/responses/asset-profile-response.interface.ts index bbf947301..884b0d411 100644 --- a/libs/common/src/lib/interfaces/responses/market-data-details-response.interface.ts +++ b/libs/common/src/lib/interfaces/responses/asset-profile-response.interface.ts @@ -2,7 +2,7 @@ import { MarketData } from '@prisma/client'; import { EnhancedSymbolProfile } from '../enhanced-symbol-profile.interface'; -export interface MarketDataDetailsResponse { +export interface AssetProfileResponse { assetProfile: Partial; marketData: MarketData[]; } diff --git a/libs/ui/src/lib/services/data.service.ts b/libs/ui/src/lib/services/data.service.ts index 6a3bed91f..1fe4ed3ec 100644 --- a/libs/ui/src/lib/services/data.service.ts +++ b/libs/ui/src/lib/services/data.service.ts @@ -40,7 +40,7 @@ import { ImportResponse, InfoItem, LookupResponse, - MarketDataDetailsResponse, + AssetProfileResponse, MarketDataOfMarketsResponse, OAuthResponse, PlatformsResponse, @@ -544,7 +544,7 @@ export class DataService { }: { dataSource: DataSource; symbol: string; - }): Observable { + }): Observable { return this.http .get(`/api/v1/asset-profiles/${dataSource}/${symbol}`) .pipe(