aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-01-06 14:21:24 -0800
committerAdam Soltys <[email protected]>2020-01-06 14:21:24 -0800
commita5a96f451f559f4f7f27529d2e5f44b0bb84d0e5 (patch)
tree96f3de45086ac3cfcc9ff85c7ed3b4e568e38921
parentbf6c5ff5a7b3bba840ae024312e721fedb488bce (diff)
downloadcoinos-server-a5a96f451f559f4f7f27529d2e5f44b0bb84d0e5.tar.gz
coinos-server-a5a96f451f559f4f7f27529d2e5f44b0bb84d0e5.zip
load all payments
-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);
+ });
};