Improve notification system after a move or at new game
[vchess.git] / server / models / Game.js
index 315b5e2..d15072d 100644 (file)
@@ -112,6 +112,19 @@ const GameModel =
                });
        },
 
+  getPlayers: function(id, cb)
+  {
+    db.serialize(function() {
+      const query =
+        "SELECT id " +
+        "FROM Players " +
+        "WHERE gid = " + id;
+      db.all(query, (err,players) => {
+        return cb(err, players);
+      });
+    });
+  },
+
   // obj can have fields move, fen and/or score
   update: function(id, obj, cb)
   {