From a5a96f451f559f4f7f27529d2e5f44b0bb84d0e5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 6 Jan 2020 14:21:24 -0800 Subject: load all payments --- payments.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/payments.js b/payments.js index 519cd1b4..b9b932dd 100644 --- a/payments.js +++ b/payments.js @@ -16,4 +16,13 @@ module.exports = async (app, auth, addresses, bc, db, emit, seen, payments) => { app.post("/payUser", auth, require("./payUser")(app, db, lnb)); app.post("/sendCoins", auth, require("./sendCoins")(app, bc, db, emit)); app.post("/addInvoice", auth, require("./addInvoice")(app, db, lnb)); + app.get("/payments", auth, async (req, res) => { + const payments = await db.Payment.findAll({ + where: { user_id: req.user.id }, + order: [['id', 'DESC']], + }); + + emit(req.user.username, "payments", payments); + res.send(payments); + }); }; -- cgit v1.2.3