X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Froutes%2Fgames.js;h=d1f233bd8fc517ca6afd525cf9a891d2189311a3;hp=a35f07d40e8ce475eb7cc35ca4f9ba3a9e6fcaf9;hb=a9b131f10ee55bd96c60180c55666df4b1f4dc4d;hpb=88667455b8793075a0266d4477fa0f4d03257cb0 diff --git a/server/routes/games.js b/server/routes/games.js index a35f07d4..d1f233bd 100644 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -40,7 +40,6 @@ router.post("/games", access.logged, access.ajax, (req,res) => { ); }); -// game page router.get("/games", access.ajax, (req,res) => { const gameId = req.query["gid"]; if (!!gameId) @@ -76,31 +75,9 @@ router.put("/games", access.logged, access.ajax, (req,res) => { }); }); -// variant page -router.get("/gamesbyvariant", access.logged, access.ajax, (req,res) => { - if (req.query["uid"] != req.user._id) - return res.json({errmsg: "Not your games"}); - let uid = ObjectId(req.query["uid"]); - let vid = ObjectId(req.query["vid"]); - GameModel.getByVariant(uid, vid, (err,gameArray) => { - // NOTE: res.json already stringify, no need to do it manually - res.json(err || {games: gameArray}); - }); -}); - -// For index: only moves count + myColor -router.get("/gamesbyplayer", access.logged, access.ajax, (req,res) => { - if (req.query["uid"] != req.user._id) - return res.json({errmsg: "Not your games"}); - let uid = ObjectId(req.query["uid"]); - GameModel.getByPlayer(uid, (err,games) => { - res.json(err || {games: games}); - }); -}); - // TODO: if newmove fail, takeback in GUI // TODO: check move structure -// TODO: for corr games, move should contain an optional "message" field ("corr chat" !) +// TODO: move should contain an optional "message" field ("corr chat" !) router.post("/moves", access.logged, access.ajax, (req,res) => { let gid = ObjectId(req.body.gid); let fen = req.body.fen;