From fe0455ffe2d93eda5792ec1ef38348ef24aba2aa Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 1 Feb 2023 19:58:13 +0000 Subject: preserve user id --- lib/invoices.js | 2 +- routes/invoices.js | 1 + routes/users.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/invoices.js b/lib/invoices.js index 814e87d9..4a09f44b 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -12,7 +12,7 @@ import ln from "$lib/ln"; export let generate = async ({ invoice, user, sender }) => { let { currency, tip, amount, rate, request_id, type } = invoice; - amount = parseInt(amount); + amount = parseInt(amount || 0); tip = parseInt(tip || 0); if (amount < 0) fail("amount out of range"); diff --git a/routes/invoices.js b/routes/invoices.js index 2ca3b006..d856ef6b 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -13,6 +13,7 @@ export default { invoice = await got(`${config.classic}/invoice/${hash}`).json(); invoice.id = invoice.uuid; invoice.classic = true; + invoice.user.id = invoice.user.uuid; invoice.user.username += "@classic"; } diff --git a/routes/users.js b/routes/users.js index 0692ed23..e3264937 100644 --- a/routes/users.js +++ b/routes/users.js @@ -235,7 +235,7 @@ export default { headers: { authorization: `Bearer ${config.admin}` } }).json(); - u = { id: v4(), about: u.address, ...pick(u, fields) }; + u = { id: u.uuid, about: u.address, ...pick(u, fields) }; delete u.address; await s(`user:${p.with.username}`, u.id); -- cgit v1.2.3