aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lightning/query.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/lightning/query.js')
-rw-r--r--routes/lightning/query.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/routes/lightning/query.js b/routes/lightning/query.js
new file mode 100644
index 00000000..012f20f4
--- /dev/null
+++ b/routes/lightning/query.js
@@ -0,0 +1,15 @@
+module.exports = async (req, res) => {
+ const { payreq } = req.body;
+
+ const invoice = await db.Invoice.findOne({
+ include: {
+ model: db.User,
+ as: "user"
+ },
+ where: {
+ text: payreq,
+ }
+ });
+
+ if (invoice) emit(req.user.username, "to", invoice.user);
+};