X-Git-Url: https://git.auder.net/assets/discord.svg?a=blobdiff_plain;f=server%2Froutes%2Fgames.js;h=4000ac782de881ab671beef519c3f76bdb328ad7;hb=51145f8c0e0595f195e26827e932306eb0083c10;hp=1b788cb970e507416d514c6aa04e7096f67557e2;hpb=fb68b0c2e3dae0be3e1f55b9516070c2731cf8d9;p=vchess.git diff --git a/server/routes/games.js b/server/routes/games.js index 1b788cb9..4000ac78 100644 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -54,7 +54,7 @@ router.get("/games", access.ajax, (req,res) => { } }); -// New move + fen update + score + chats... +// FEN update + score(Msg) + draw status / and new move + chats router.put("/games", access.logged, access.ajax, (req,res) => { const gid = req.body.gid; const obj = req.body.newObj; @@ -83,4 +83,18 @@ router.put("/games", access.logged, access.ajax, (req,res) => { } }); +// TODO: chats deletion here, but could/should be elsewhere. +// Moves update also could, although logical unit in a game. +router.delete("/chats", access.logged, access.ajax, (req,res) => { + const gid = req.query["gid"]; + GameModel.getPlayers(gid, (err,players) => { + if (players.some(p => p.uid == req.userId)) + { + GameModel.update(gid, {delchat: true}, () => { + res.json({}); + }); + } + }); +}); + module.exports = router;