diff options
| author | Adam Soltys <[email protected]> | 2020-03-26 10:19:58 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-03-26 10:19:58 -0700 |
| commit | b75a06ea0dadcb7ad2416e900e15276661e065be (patch) | |
| tree | 873b67947303a64acfaa018900b590651331928b /routes | |
| parent | 4eee705620cb0a7626d9d000d4c78c4691784bff (diff) | |
| download | coinos-server-b75a06ea0dadcb7ad2416e900e15276661e065be.tar.gz coinos-server-b75a06ea0dadcb7ad2416e900e15276661e065be.zip | |
filter payments
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.js | 11 |
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"]] }); |
