aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-03-26 10:19:58 -0700
committerAdam Soltys <[email protected]>2020-03-26 10:19:58 -0700
commitb75a06ea0dadcb7ad2416e900e15276661e065be (patch)
tree873b67947303a64acfaa018900b590651331928b /routes
parent4eee705620cb0a7626d9d000d4c78c4691784bff (diff)
downloadcoinos-server-b75a06ea0dadcb7ad2416e900e15276661e065be.tar.gz
coinos-server-b75a06ea0dadcb7ad2416e900e15276661e065be.zip
filter payments
Diffstat (limited to 'routes')
-rw-r--r--routes/payments.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/routes/payments.js b/routes/payments.js
index 7cb51d02..0e829029 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -1,5 +1,6 @@
const BitcoinCore = require("bitcoin-core");
const lnd = require("../lib/lnd");
+const { Op } = require("sequelize");
(async () => {
bc = new BitcoinCore(config.bitcoin);
@@ -37,7 +38,15 @@ const lnd = require("../lib/lnd");
app.get("/payments", auth, async (req, res) => {
const payments = await db.Payment.findAll({
- where: { user_id: req.user.id },
+ where: {
+ user_id: req.user.id,
+ [Op.or]: {
+ received: true,
+ amount: {
+ [Op.lt]: 0,
+ },
+ },
+ },
order: [["id", "DESC"]]
});