From 64d1a8758fb2075e0ba071c5aa012fb17972740a Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 25 Jul 2026 18:16:35 +0700 Subject: [PATCH] fix(api): resolve type errors in benchmark service --- .../src/services/benchmark/benchmark.service.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/api/src/services/benchmark/benchmark.service.ts b/apps/api/src/services/benchmark/benchmark.service.ts index affb0da08f..17e729f9f4 100644 --- a/apps/api/src/services/benchmark/benchmark.service.ts +++ b/apps/api/src/services/benchmark/benchmark.service.ts @@ -18,7 +18,6 @@ import { BenchmarkProperty, BenchmarkResponse } from '@ghostfolio/common/interfaces'; -import { BenchmarkTrend } from '@ghostfolio/common/types'; import { Injectable, Logger } from '@nestjs/common'; import { SymbolProfile } from '@prisma/client'; @@ -146,7 +145,7 @@ export class BenchmarkService { public async addBenchmark({ dataSource, symbol - }: AssetProfileIdentifier): Promise> { + }: AssetProfileIdentifier): Promise | undefined> { const assetProfile = await this.prismaService.symbolProfile.findFirst({ where: { dataSource, @@ -183,7 +182,7 @@ export class BenchmarkService { public async deleteBenchmark({ dataSource, symbol - }: AssetProfileIdentifier): Promise> { + }: AssetProfileIdentifier): Promise | null> { const assetProfile = await this.prismaService.symbolProfile.findFirst({ where: { dataSource, @@ -240,12 +239,12 @@ export class BenchmarkService { enableSharing }); - const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] = - []; - const promisesBenchmarkTrends: Promise<{ - trend50d: BenchmarkTrend; - trend200d: BenchmarkTrend; - }>[] = []; + const promisesAllTimeHighs: ReturnType< + typeof this.marketDataService.getMax + >[] = []; + const promisesBenchmarkTrends: ReturnType< + typeof this.getBenchmarkTrends + >[] = []; const quotes = await this.dataProviderService.getQuotes({ items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => {