aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/send.js2
-rw-r--r--routes/users.js16
2 files changed, 17 insertions, 1 deletions
diff --git a/routes/send.js b/routes/send.js
index 653da87b..0c93d0a2 100644
--- a/routes/send.js
+++ b/routes/send.js
@@ -99,7 +99,7 @@ module.exports = ah(async (req, res, next) => {
};
if (address) params.where.address = address;
else if (payreq) params.where.text = payreq;
- let invoice = await db.Invoice.findOne(params);
+ let invoice = (address || payreq) && await db.Invoice.findOne(params);
let a2;
let acc = {
diff --git a/routes/users.js b/routes/users.js
index ef220a32..bcce9c14 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -32,7 +32,23 @@ app.get(
auth,
ah(async (req, res) => {
let user = req.user.get({ plain: true });
+ let payments = await req.user.getPayments({
+ where: {
+ account_id: user.account_id
+ },
+ order: [["id", "DESC"]],
+ limit: 12,
+ include: [{
+ model: db.Account,
+ as: "account"
+ },
+ {
+ model: db.Payment,
+ as: "fee_payment"
+ }]
+ });
user.accounts = await req.user.getAccounts();
+ user.payments = payments;
res.send(user);
})
);