Update code to remove users in tournament DB as well
authorBenjamin Auder <benjamin.auder@somewhere>
Fri, 11 Dec 2020 17:12:25 +0000 (18:12 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Fri, 11 Dec 2020 17:12:25 +0000 (18:12 +0100)
server/models/User.js
server/routes/users.js

index ebda4c3..d62cd76 100644 (file)
@@ -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);
         }
       });
     });
index 21585c7..f1554ef 100644 (file)
@@ -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({});
       }
     });