From: Benjamin Auder Date: Fri, 11 Dec 2020 17:12:25 +0000 (+0100) Subject: Update code to remove users in tournament DB as well X-Git-Url: https://git.auder.net/doc/html/packages.html?a=commitdiff_plain;h=e28519f25f88ee133fc8aaa766c9bd95eec6c1ba;p=vchess.git Update code to remove users in tournament DB as well --- diff --git a/server/models/User.js b/server/models/User.js index ebda4c32..d62cd767 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -171,10 +171,13 @@ const UserModel = { } }); if (toRemove.length > 0) { + const remArg = toRemove.join(","); db.run( "DELETE FROM Users " + - "WHERE id IN (" + toRemove.join(",") + ")" + "WHERE id IN (" + remArg + ")" ); + // Update tournament DB: + exec(params.tourneyPath + "/dbsync/delete_users.py " + remArg); } }); }); diff --git a/server/routes/users.js b/server/routes/users.js index 21585c7c..f1554ef7 100644 --- a/server/routes/users.js +++ b/server/routes/users.js @@ -51,7 +51,7 @@ router.post('/register', access.unlogged, access.ajax, (req,res) => { }; setAndSendLoginToken("Welcome to " + params.siteURL, user); // Update tournament DB (TODO: if error, log it) - exec(params.tourneyPath + "/sync_users.py"); + exec(params.tourneyPath + "/dbsync/update_users.py"); res.json({}); } });