Browse Source

fix(api): resolve type errors in benchmark service

pull/7417/head
KenTandrian 1 month ago
parent
commit
64d1a8758f
  1. 17
      apps/api/src/services/benchmark/benchmark.service.ts

17
apps/api/src/services/benchmark/benchmark.service.ts

@ -18,7 +18,6 @@ import {
BenchmarkProperty, BenchmarkProperty,
BenchmarkResponse BenchmarkResponse
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { BenchmarkTrend } from '@ghostfolio/common/types';
import { Injectable, Logger } from '@nestjs/common'; import { Injectable, Logger } from '@nestjs/common';
import { SymbolProfile } from '@prisma/client'; import { SymbolProfile } from '@prisma/client';
@ -146,7 +145,7 @@ export class BenchmarkService {
public async addBenchmark({ public async addBenchmark({
dataSource, dataSource,
symbol symbol
}: AssetProfileIdentifier): Promise<Partial<SymbolProfile>> { }: AssetProfileIdentifier): Promise<Partial<SymbolProfile> | undefined> {
const assetProfile = await this.prismaService.symbolProfile.findFirst({ const assetProfile = await this.prismaService.symbolProfile.findFirst({
where: { where: {
dataSource, dataSource,
@ -183,7 +182,7 @@ export class BenchmarkService {
public async deleteBenchmark({ public async deleteBenchmark({
dataSource, dataSource,
symbol symbol
}: AssetProfileIdentifier): Promise<Partial<SymbolProfile>> { }: AssetProfileIdentifier): Promise<Partial<SymbolProfile> | null> {
const assetProfile = await this.prismaService.symbolProfile.findFirst({ const assetProfile = await this.prismaService.symbolProfile.findFirst({
where: { where: {
dataSource, dataSource,
@ -240,12 +239,12 @@ export class BenchmarkService {
enableSharing enableSharing
}); });
const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] = const promisesAllTimeHighs: ReturnType<
[]; typeof this.marketDataService.getMax
const promisesBenchmarkTrends: Promise<{ >[] = [];
trend50d: BenchmarkTrend; const promisesBenchmarkTrends: ReturnType<
trend200d: BenchmarkTrend; typeof this.getBenchmarkTrends
}>[] = []; >[] = [];
const quotes = await this.dataProviderService.getQuotes({ const quotes = await this.dataProviderService.getQuotes({
items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => { items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => {

Loading…
Cancel
Save