From b26521c4bd8568c97300206451aa829bdbf6f637 Mon Sep 17 00:00:00 2001 From: Valentin Zickner Date: Thu, 8 Jul 2021 00:02:25 +0200 Subject: [PATCH] add workaround for database date search --- apps/api/src/app/core/market-data.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/core/market-data.service.ts b/apps/api/src/app/core/market-data.service.ts index 6a16b2dee..06a3991f0 100644 --- a/apps/api/src/app/core/market-data.service.ts +++ b/apps/api/src/app/core/market-data.service.ts @@ -1,6 +1,7 @@ import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { Injectable } from '@nestjs/common'; import { MarketData } from '@prisma/client'; +import { subDays } from 'date-fns'; @Injectable() export class MarketDataService { @@ -14,7 +15,13 @@ export class MarketDataService { symbol: string; }): Promise { return await this.prisma.marketData.findFirst({ - where: { date, symbol } + where: { + date: { + gte: subDays(date, 1), + lt: date + }, + symbol + } }); } }