aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-01 11:42:30 -0700
committerAdam Soltys <[email protected]>2022-11-01 11:42:30 -0700
commit440a026553f5b3aded02e35843f98e2b03e32c19 (patch)
tree1ffcc29843216ec42e43fdb0b7e1ee8a05b5b8d6
parenta498bfc1ef952e75da26c16d838bae89faf10cfc (diff)
parentd60f0d51c5449352f688fa11b646498e907cb726 (diff)
downloadcoinos-server-440a026553f5b3aded02e35843f98e2b03e32c19.tar.gz
coinos-server-440a026553f5b3aded02e35843f98e2b03e32c19.zip
Merge branch 'master' into prod
-rw-r--r--routes/payments.js13
1 files changed, 4 insertions, 9 deletions
diff --git a/routes/payments.js b/routes/payments.js
index 0cd45829..4c71cde0 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -106,21 +106,17 @@ app.get("/payments", auth, async (req, res) => {
if (limit) limit = parseInt(limit);
if (offset) offset = parseInt(offset);
- let dayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
-
let where = {
account_id: req.user.account_id,
- createdAt: { [Op.gte]: dayAgo }
+ createdAt: {}
};
- if (start) where.createdAt[Op.gte] = new Date(start * 1000);
- if (end) where.createdAt[Op.lte] = new Date(end * 1000);
+ if (start) where.createdAt[Op.gte] = new Date(parseInt(start));
+ if (end) where.createdAt[Op.lte] = new Date(end);
if (!req.user.account_id) return res.send([]);
- let total = await db.Payment.count({
- where
- });
+ let total = await db.Payment.count({ where });
let payments = await db.Payment.findAll({
where,
@@ -133,7 +129,6 @@ app.get("/payments", auth, async (req, res) => {
offset
});
-
if (v2) {
res.send({ transactions: payments, total });
} else {