add workaround for database date search

pull/239/head
Valentin Zickner 3 years ago committed by Thomas
parent cfee6c1ddd
commit b26521c4bd

@ -1,6 +1,7 @@
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaService } from '@ghostfolio/api/services/prisma.service';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { MarketData } from '@prisma/client'; import { MarketData } from '@prisma/client';
import { subDays } from 'date-fns';
@Injectable() @Injectable()
export class MarketDataService { export class MarketDataService {
@ -14,7 +15,13 @@ export class MarketDataService {
symbol: string; symbol: string;
}): Promise<MarketData> { }): Promise<MarketData> {
return await this.prisma.marketData.findFirst({ return await this.prisma.marketData.findFirst({
where: { date, symbol } where: {
date: {
gte: subDays(date, 1),
lt: date
},
symbol
}
}); });
} }
} }

Loading…
Cancel
Save