From 3098f0c849f696b39714799c6c1663936946e61b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 26 Feb 2022 00:27:21 -0500 Subject: fix rounding errors --- routes/users.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'routes/users.js') diff --git a/routes/users.js b/routes/users.js index 6e6d1ddc..403c4646 100644 --- a/routes/users.js +++ b/routes/users.js @@ -623,7 +623,7 @@ app.post( res.end(); }); } catch (e) { - l.error(e.message); + l.error("problem updating account", e.message); return res.status(500).send("There was a problem updating the account"); } }) @@ -638,14 +638,16 @@ app.post( try { const account = await db.Account.findOne({ - where: { id, user_id: user.id } + where: { id } }); + if (account.user_id !== user.id) + return res.status(500).send("Failed to open wallet"); + user.account_id = account.id; await user.save(); let payments = await db.Payment.findAll({ where: { - user_id: user.id, account_id: id }, order: [["id", "DESC"]], @@ -663,7 +665,7 @@ app.post( res.send(user); } catch (e) { - l.error(e.message); + l.error("problem switching account", e.message); return res.status(500).send("There was a problem switching accounts"); } }) -- cgit v1.2.3