X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Fmodels%2FGame.js;h=caa15c39579c992c1e474cfa294147726a6edd24;hp=e45c18275ce2453d949667956a37544ad22106a7;hb=584f81b93154313a3856112400b7df98e0eb2632;hpb=da37e2b8639a5c2fa8f10d7a94acb90a7b358647 diff --git a/server/models/Game.js b/server/models/Game.js index e45c1827..caa15c39 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -39,7 +39,7 @@ const GameModel = g.cadence.match(/^[0-9dhms +]+$/) && g.fen.match(/^[a-zA-Z0-9, /-]*$/) && g.players.length == 2 && - g.players.every(p => p.id.toString().match(/^[0-9]+$/)) + g.players.every(p => p.uid.toString().match(/^[0-9]+$/)) ); }, @@ -60,7 +60,7 @@ const GameModel = const color = (idx==0 ? "w" : "b"); query = "INSERT INTO Players VALUES " + - "(" + this.lastID + "," + p.id + ",'" + color + "')"; + "(" + this.lastID + "," + p.uid + ",'" + color + "')"; db.run(query); }); cb(null, {gid: this.lastID}); @@ -99,7 +99,8 @@ const GameModel = "FROM Chats " + "WHERE gid = " + id; db.all(query, (err4, chats) => { - const game = Object.assign({}, + const game = Object.assign( + {}, gameInfo, { players: players, @@ -140,7 +141,8 @@ const GameModel = "FROM Moves " + "WHERE gid = " + id; db.get(query, (err,ret) => { - const game = Object.assign({}, + const game = Object.assign( + {}, gameInfo, { players: players,