From eb860d78b836d810f7c29d5587e17321adf20bef Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 13 Jan 2021 14:21:47 -0800 Subject: add some more transaction locks --- routes/users.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'routes/users.js') diff --git a/routes/users.js b/routes/users.js index d6199cb7..e7aec50e 100644 --- a/routes/users.js +++ b/routes/users.js @@ -507,6 +507,12 @@ app.post( } = req.body; try { + let account = await db.Account.findOne({ + where: { id, user_id: user.id } + }); + + if (!account || (account.pubkey && !pubkey)) throw new Error("Problem updating account"); + await db.Account.update( { name, @@ -525,7 +531,7 @@ app.post( } ); - const account = await db.Account.findOne({ + account = await db.Account.findOne({ where: { id } }); -- cgit v1.2.3