From b75a06ea0dadcb7ad2416e900e15276661e065be Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Mar 2020 10:19:58 -0700 Subject: filter payments --- lib/sockets.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sockets.js b/lib/sockets.js index d7973a99..f35ca5f5 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -1,6 +1,6 @@ const jwt = require("jsonwebtoken"); const io = require("socket.io"); -const Sequelize = require("sequelize"); +const { Op } = require("sequelize"); /* eslint-disable-next-line */ const pick = (O, ...K) => K.reduce((o, k) => ((o[k] = O[k]), o), {}); @@ -44,8 +44,13 @@ socket.sockets.on("connect", async socket => { model: db.Payment, as: "payments", order: [["id", "DESC"]], - received: { - [Sequelize.Op.ne]: null + where: { + [Op.or]: { + received: true, + amount: { + [Op.lt]: 0, + }, + }, }, limit: 12 } -- cgit v1.2.3