From 95d7dc049dfdd9d3beba54aef7921ec3a2816d71 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 16 Mar 2023 23:00:51 -0700 Subject: prettier --- routes/payments.js | 9 ++++----- routes/users.js | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/routes/payments.js b/routes/payments.js index c09fcf93..b8999f55 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -35,10 +35,9 @@ catchUp(); export default { async create({ body, user }, res) { - let { amount, hash, maxfee, name, memo, payreq, username } = body; + let { amount, hash, maxfee, name, memo, payreq, username } = body; try { - amount = parseInt(amount); maxfee = maxfee ? parseInt(maxfee) : 0; @@ -414,10 +413,10 @@ export default { for (let pid of payments) { let p = await g(`payment:${pid}`); total += p.amount; - if (p.amount < 0) total -= ((p.fee || 0) + (p.ourfee || 0)); - } + if (p.amount < 0) total -= (p.fee || 0) + (p.ourfee || 0); + } - l('corrected balance', username, uid, balance, total); + l("corrected balance", username, uid, balance, total); await s(`balance:${uid}`, total); res.send("ok"); } catch (e) { diff --git a/routes/users.js b/routes/users.js index c9efc795..1aadd471 100644 --- a/routes/users.js +++ b/routes/users.js @@ -72,7 +72,7 @@ export default { username: key, display: key.substr(0, 6), pubkey: key, - anon: true + anon: true, }; } @@ -89,7 +89,7 @@ export default { "pubkey", "display", "prompt", - "id" + "id", ]; if (user.pubkey) @@ -113,7 +113,7 @@ export default { pubkey, password, username, - salt + salt, }; user = await register(user, ip, false); @@ -189,7 +189,7 @@ export default { "salt", "seed", "tokens", - "twofa" + "twofa", ]; for (let a of attributes) { @@ -229,7 +229,7 @@ export default { if (!token) fail(); user = await got(`${classic}/admin/migrate/${username}?zero=true`, { - headers: { authorization: `Bearer ${config.admin}` } + headers: { authorization: `Bearer ${config.admin}` }, }).json(); let { balance } = user; @@ -241,7 +241,7 @@ export default { ...pick(user, fields), id: uid, about: user.address, - migrated: true + migrated: true, }; await s(`user:${username}`, uid); @@ -249,7 +249,7 @@ export default { await s(`balance:${uid}`, balance); let payments = await got(`${classic}/payments`, { - headers: { authorization: `Bearer ${token}` } + headers: { authorization: `Bearer ${token}` }, }).json(); for (let p of payments) { @@ -259,7 +259,7 @@ export default { "confirmed", "rate", "currency", - "preimage" + "preimage", ]); n.id = v4(); n.created = parseISO(p.createdAt).getTime(); @@ -277,7 +277,7 @@ export default { u = await got( `${classic}/admin/migrate/${p.with.username.toLowerCase()}`, { - headers: { authorization: `Bearer ${config.admin}` } + headers: { authorization: `Bearer ${config.admin}` }, } ).json(); @@ -349,7 +349,7 @@ export default { if (!subscriptions) subscriptions = []; if ( !subscriptions.find( - s => JSON.stringify(s) === JSON.stringify(subscription) + (s) => JSON.stringify(s) === JSON.stringify(subscription) ) ) subscriptions.push(subscription); @@ -386,8 +386,8 @@ export default { let contacts = (await g(`${id}:contacts`)) || []; for (let { ref } of ( - await Promise.all(payments.map(async id => await g(`payment:${id}`))) - ).filter(p => p.type === types.internal && p.ref)) { + await Promise.all(payments.map(async (id) => await g(`payment:${id}`))) + ).filter((p) => p.type === types.internal && p.ref)) { !~contacts.findIndex(({ id }) => id === ref) && contacts.push(await g(`user:${ref}`)); } @@ -424,5 +424,5 @@ export default { } res.send("ok"); - } + }, }; -- cgit v1.2.3