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 {
date: Date;
symbol: string;
marketPrice: number;
symbol: string;
}

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

@ -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<MarketData> {
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[];
}

Loading…
Cancel
Save