Refactoring

pull/239/head
Thomas 3 years ago
parent 5e9cecc6c1
commit 47d71405e1

@ -0,0 +1,5 @@
export interface DateQuery {
gte?: Date;
in?: Date[];
lt?: Date;
}

@ -1,5 +1,5 @@
export interface GetValueObject { export interface GetValueObject {
date: Date; date: Date;
symbol: string;
marketPrice: number; marketPrice: number;
symbol: string;
} }

@ -1,8 +1,8 @@
import { Currency } from '@prisma/client'; import { Currency } from '@prisma/client';
export interface GetValueParams { export interface GetValueParams {
currency: Currency;
date: Date; date: Date;
symbol: string; symbol: string;
currency: Currency;
userCurrency: Currency; userCurrency: Currency;
} }

@ -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'; import { Currency } from '@prisma/client';
export interface GetValuesParams { export interface GetValuesParams {
currencies: { [symbol: string]: Currency };
dateQuery: DateQuery; dateQuery: DateQuery;
symbols: string[]; symbols: string[];
currencies: { [symbol: string]: Currency };
userCurrency: Currency; userCurrency: Currency;
} }

@ -2,6 +2,7 @@ import { PrismaService } from '@ghostfolio/api/services/prisma.service';
import { resetHours } from '@ghostfolio/common/helper'; import { resetHours } from '@ghostfolio/common/helper';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { MarketData } from '@prisma/client'; import { MarketData } from '@prisma/client';
import { DateQuery } from './date-query.interface';
@Injectable() @Injectable()
export class MarketDataService { export class MarketDataService {
@ -16,8 +17,8 @@ export class MarketDataService {
}): Promise<MarketData> { }): Promise<MarketData> {
return await this.prisma.marketData.findFirst({ return await this.prisma.marketData.findFirst({
where: { 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[];
}

Loading…
Cancel
Save