From dd088e8777718b17f88b1775db9e55972c3bc412 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 17 Aug 2021 14:13:16 -0700 Subject: order by id --- routes/send.js | 1 + 1 file changed, 1 insertion(+) (limited to 'routes') diff --git a/routes/send.js b/routes/send.js index 9b4396ef..1a9783e0 100644 --- a/routes/send.js +++ b/routes/send.js @@ -85,6 +85,7 @@ module.exports = ah(async (req, res, next) => { let text = address || payreq; params = { where: { user_id: recipient.id }, + order: [["id", "DESC"]], }; if (text) params.where.text = text; let invoice = await db.Invoice.findOne(params); -- cgit v1.2.3 From 01b96b95507d6ffd6c551c834bea5478b190d308 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 17 Aug 2021 22:38:38 -0700 Subject: don't emit user --- routes/send.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'routes') diff --git a/routes/send.js b/routes/send.js index 1a9783e0..e8fdb79c 100644 --- a/routes/send.js +++ b/routes/send.js @@ -68,7 +68,6 @@ module.exports = ah(async (req, res, next) => { emit(user.username, "payment", payment); emit(user.username, "account", account); - emit(user.username, "user", user); if (username) { let recipient = await db.User.findOne( @@ -165,8 +164,8 @@ module.exports = ah(async (req, res, next) => { p2 = p2.get({ plain: true }); p2.account = a2.get({ plain: true }); - emit(recipient.username, "account", p2.account); emit(recipient.username, "payment", p2); + emit(recipient.username, "account", p2.account); l.info("received internal", recipient.username, amount); notify(recipient, `Received ${amount} ${a2.ticker} sats`); -- cgit v1.2.3 From 2a0252707890c156c008719574f0da000b853ba2 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Wed, 18 Aug 2021 14:22:32 -0500 Subject: Documented /api/info --- apidoc/api_data.js | 37 +++++++++++++++++++++++++++++++++++++ apidoc/api_data.json | 37 +++++++++++++++++++++++++++++++++++++ apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- routes/info.js | 9 +++++++++ 5 files changed, 85 insertions(+), 2 deletions(-) (limited to 'routes') diff --git a/apidoc/api_data.js b/apidoc/api_data.js index 961f82a7..63c793fa 100644 --- a/apidoc/api_data.js +++ b/apidoc/api_data.js @@ -374,6 +374,43 @@ define({ "api": [ "filename": "routes/admin.js", "groupTitle": "Admin" }, + { + "type": "get", + "url": "/info", + "title": "Request server information", + "name": "GetInfo", + "group": "Info", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "fx", + "description": "

Exchange rates relative to USD - fx.CUR is the value of one CUR in USD.

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "networks", + "description": "

Array of supported networks; possible values are "bitcoin", "liquid" and "lightning".

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "clientVersion", + "description": "

the current git commit of the ui

" + } + ] + } + }, + "version": "0.0.0", + "filename": "routes/info.js", + "groupTitle": "Info" + }, { "type": "post", "url": "/grant", diff --git a/apidoc/api_data.json b/apidoc/api_data.json index 180cbe16..5bab3ee7 100644 --- a/apidoc/api_data.json +++ b/apidoc/api_data.json @@ -374,6 +374,43 @@ "filename": "routes/admin.js", "groupTitle": "Admin" }, + { + "type": "get", + "url": "/info", + "title": "Request server information", + "name": "GetInfo", + "group": "Info", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "fx", + "description": "

Exchange rates relative to USD - fx.CUR is the value of one CUR in USD.

" + }, + { + "group": "Success 200", + "type": "String[]", + "optional": false, + "field": "networks", + "description": "

Array of supported networks; possible values are "bitcoin", "liquid" and "lightning".

" + }, + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "clientVersion", + "description": "

the current git commit of the ui

" + } + ] + } + }, + "version": "0.0.0", + "filename": "routes/info.js", + "groupTitle": "Info" + }, { "type": "post", "url": "/grant", diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ef1b3f4c..b382cf76 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -9,7 +9,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-18T18:43:04.642Z", + "time": "2021-08-18T19:13:24.486Z", "url": "https://apidocjs.com", "version": "0.29.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 828595f0..42943876 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -9,7 +9,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-18T18:43:04.642Z", + "time": "2021-08-18T19:13:24.486Z", "url": "https://apidocjs.com", "version": "0.29.0" } diff --git a/routes/info.js b/routes/info.js index 6d9d5f32..8d098a2f 100644 --- a/routes/info.js +++ b/routes/info.js @@ -1,6 +1,15 @@ const sequelize = require("sequelize"); const { Op } = sequelize; +/** + * @api {get} /info Request server information + * @apiName GetInfo + * @apiGroup Info + * + * @apiSuccess {Object} fx Exchange rates relative to USD - fx.CUR is the value of one CUR in USD. + * @apiSuccess {String[]} networks Array of supported networks; possible values are "bitcoin", "liquid" and "lightning". + * @apiSuccess {String} clientVersion the current git commit of the ui + */ app.get("/info", ah(async (req, res, next) => { const { clientVersion } = config; -- cgit v1.2.3