diff options
| author | Adam Soltys <[email protected]> | 2022-02-26 00:27:21 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-02-26 00:27:55 -0500 |
| commit | 3098f0c849f696b39714799c6c1663936946e61b (patch) | |
| tree | 1095f9caa720dc9462429ef3a76feff7690690c4 /routes/users.js | |
| parent | 46bc3fdc3d5c5da1c7f6ecb27e949da7687398b7 (diff) | |
| download | coinos-server-3098f0c849f696b39714799c6c1663936946e61b.tar.gz coinos-server-3098f0c849f696b39714799c6c1663936946e61b.zip | |
fix rounding errors
Diffstat (limited to 'routes/users.js')
| -rw-r--r-- | routes/users.js | 10 |
1 files changed, 6 insertions, 4 deletions
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"); } }) |
