aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--payments.js9
1 files changed, 9 insertions, 0 deletions
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);
+ });
};