diff --git a/apps/api/src/app/core/date-query.interface.ts b/apps/api/src/app/core/date-query.interface.ts new file mode 100644 index 000000000..7145d4111 --- /dev/null +++ b/apps/api/src/app/core/date-query.interface.ts @@ -0,0 +1,5 @@ +export interface DateQuery { + gte?: Date; + in?: Date[]; + lt?: Date; +} diff --git a/apps/api/src/app/core/get-value-object.interface.ts b/apps/api/src/app/core/get-value-object.interface.ts index 0e4d66d84..8072a5ea6 100644 --- a/apps/api/src/app/core/get-value-object.interface.ts +++ b/apps/api/src/app/core/get-value-object.interface.ts @@ -1,5 +1,5 @@ export interface GetValueObject { date: Date; - symbol: string; marketPrice: number; + symbol: string; } diff --git a/apps/api/src/app/core/get-value-params.interface.ts b/apps/api/src/app/core/get-value-params.interface.ts index ffe57c3f2..bff927206 100644 --- a/apps/api/src/app/core/get-value-params.interface.ts +++ b/apps/api/src/app/core/get-value-params.interface.ts @@ -1,8 +1,8 @@ import { Currency } from '@prisma/client'; export interface GetValueParams { + currency: Currency; date: Date; symbol: string; - currency: Currency; userCurrency: Currency; } diff --git a/apps/api/src/app/core/get-values-params.interface.ts b/apps/api/src/app/core/get-values-params.interface.ts index ee1d550d7..b09d26af9 100644 --- a/apps/api/src/app/core/get-values-params.interface.ts +++ b/apps/api/src/app/core/get-values-params.interface.ts @@ -1,9 +1,9 @@ -import { DateQuery } from '@ghostfolio/api/app/core/market-data.service'; +import { DateQuery } from '@ghostfolio/api/app/core/date-query.interface'; import { Currency } from '@prisma/client'; export interface GetValuesParams { + currencies: { [symbol: string]: Currency }; dateQuery: DateQuery; symbols: string[]; - currencies: { [symbol: string]: Currency }; userCurrency: Currency; } diff --git a/apps/api/src/app/core/market-data.service.ts b/apps/api/src/app/core/market-data.service.ts index 6b4a916a3..e493b2aa7 100644 --- a/apps/api/src/app/core/market-data.service.ts +++ b/apps/api/src/app/core/market-data.service.ts @@ -2,6 +2,7 @@ import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { resetHours } from '@ghostfolio/common/helper'; import { Injectable } from '@nestjs/common'; import { MarketData } from '@prisma/client'; +import { DateQuery } from './date-query.interface'; @Injectable() export class MarketDataService { @@ -16,8 +17,8 @@ export class MarketDataService { }): Promise { return await this.prisma.marketData.findFirst({ where: { - date: resetHours(date), - symbol + symbol, + date: resetHours(date) } }); } @@ -47,9 +48,3 @@ export class MarketDataService { }); } } - -export interface DateQuery { - gte?: Date; - lt?: Date; - in?: Date[]; -}