aboutsummaryrefslogtreecommitdiffstats
path: root/routes/users.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-02-26 00:27:21 -0500
committerAdam Soltys <[email protected]>2022-02-26 00:27:55 -0500
commit3098f0c849f696b39714799c6c1663936946e61b (patch)
tree1095f9caa720dc9462429ef3a76feff7690690c4 /routes/users.js
parent46bc3fdc3d5c5da1c7f6ecb27e949da7687398b7 (diff)
downloadcoinos-server-3098f0c849f696b39714799c6c1663936946e61b.tar.gz
coinos-server-3098f0c849f696b39714799c6c1663936946e61b.zip
fix rounding errors
Diffstat (limited to 'routes/users.js')
-rw-r--r--routes/users.js10
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");
}
})