From e31957e3030a8d402a38062476915b4416aa8507 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 1 Nov 2022 18:56:34 +0000 Subject: fix payments query --- routes/payments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/payments.js b/routes/payments.js index 678b646c..d60d4e2e 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -108,9 +108,9 @@ app.get("/payments", auth, async (req, res) => { let where = { account_id: req.user.account_id, - createdAt: {} }; + if (start || end) where.createdAt = {}; if (start) where.createdAt[Op.gte] = new Date(parseInt(start)); if (end) where.createdAt[Op.lte] = new Date(parseInt(end)); -- cgit v1.2.3