aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-08-06 20:15:21 -0700
committerAdam Soltys <[email protected]>2020-08-06 20:15:21 -0700
commit2a960a2448c3b936599a933b63a92af5d67273de (patch)
tree20b390a8776abb3446cc85017f2e8e2bc1c1d422 /routes/bitcoin
parent40fc89ab9b00da0d5928e663c7fde0717b2a96af (diff)
downloadcoinos-server-2a960a2448c3b936599a933b63a92af5d67273de.tar.gz
coinos-server-2a960a2448c3b936599a933b63a92af5d67273de.zip
user exists endpoint
Diffstat (limited to 'routes/bitcoin')
-rw-r--r--routes/bitcoin/fee.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/routes/bitcoin/fee.js b/routes/bitcoin/fee.js
index 220fbae9..da0fb9e9 100644
--- a/routes/bitcoin/fee.js
+++ b/routes/bitcoin/fee.js
@@ -3,12 +3,19 @@ module.exports = ah(async (req, res) => {
let { address, amount, feeRate } = req.body;
let tx, fee;
- let recipient = await db.User.findOne({
- attributes: ['username'],
- where: { address }
+ let invoice = await db.Invoice.findOne({
+ where: { address },
+ include: {
+ attributes: ['username'],
+ model: db.User,
+ as: 'user',
+ }
});
- if (recipient)
- emit(user.username, "to", recipient);
+
+ if (invoice) {
+ emit(user.username, "to", invoice.user);
+ return res.end();
+ }
try {
amount = parseInt(amount);