Remove unecessary check

This commit is contained in:
Douglas Barone 2021-01-04 15:07:38 -04:00
parent ce1ce11877
commit d77f1a96b2

View File

@ -3,14 +3,12 @@ import prisma from '../../prisma'
const MAX_RESULT = 5000 const MAX_RESULT = 5000
export async function logs(parent, { search, dateIn, dateOut, limit }) { export async function logs(parent, { search, dateIn, dateOut, limit }) {
if (!dateOut) dateOut = new Date()
try { try {
const logs = await prisma.log.findMany({ const logs = await prisma.log.findMany({
where: { where: {
timestamp: { timestamp: {
gte: dateIn ? new Date(dateIn) : undefined, gte: dateIn ? new Date(dateIn) : undefined,
lte: new Date(dateOut) lte: dateOut ? new Date(dateOut) : undefined
} }
}, },
orderBy: { timestamp: 'desc' }, orderBy: { timestamp: 'desc' },