Browse Source

Address review feedback for #7079

pull/7079/head
AkashNegi1 4 weeks ago
parent
commit
1eb1753ce7
  1. 1
      CHANGELOG.md
  2. 2
      apps/api/src/app/asset/asset.controller.ts
  3. 2
      apps/api/src/app/asset/asset.module.ts
  4. 12
      apps/api/src/app/endpoints/asset-profiles/asset-profiles.controller.ts
  5. 4
      apps/api/src/app/endpoints/asset-profiles/asset-profiles.module.ts
  6. 4
      apps/api/src/app/endpoints/asset-profiles/asset-profiles.service.ts
  7. 4
      libs/common/src/lib/interfaces/index.ts
  8. 2
      libs/common/src/lib/interfaces/responses/asset-profile-response.interface.ts
  9. 4
      libs/ui/src/lib/services/data.service.ts

1
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

2
apps/api/src/app/asset/asset.controller.ts

@ -21,7 +21,7 @@ export class AssetController {
@Param('symbol') symbol: string
): Promise<AssetResponse> {
const { assetProfile, marketData } =
await this.assetProfilesService.getMarketDataBySymbol({
await this.assetProfilesService.getAssetProfile({
dataSource,
symbol
});

2
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({

12
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<MarketDataDetailsResponse> {
): Promise<AssetProfileResponse> {
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
});

4
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 {}

4
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<AdminMarketDataDetails> {

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

2
libs/common/src/lib/interfaces/responses/market-data-details-response.interface.ts → 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<EnhancedSymbolProfile>;
marketData: MarketData[];
}

4
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<MarketDataDetailsResponse> {
}): Observable<AssetProfileResponse> {
return this.http
.get<any>(`/api/v1/asset-profiles/${dataSource}/${symbol}`)
.pipe(

Loading…
Cancel
Save