From 1ef66c962a1cea81dee4f5db32cd011feac7de44 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 17 Jun 2018 08:10:54 +0900 Subject: reversi :white_flower: :100: --- src/server/api/endpoints/othello/games/show.ts | 32 -------------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/server/api/endpoints/othello/games/show.ts (limited to 'src/server/api/endpoints/othello/games') diff --git a/src/server/api/endpoints/othello/games/show.ts b/src/server/api/endpoints/othello/games/show.ts deleted file mode 100644 index 6b2f5ce137..0000000000 --- a/src/server/api/endpoints/othello/games/show.ts +++ /dev/null @@ -1,32 +0,0 @@ -import $ from 'cafy'; import ID from '../../../../../cafy-id'; -import OthelloGame, { pack } from '../../../../../models/othello-game'; -import Othello from '../../../../../othello/core'; - -module.exports = (params, user) => new Promise(async (res, rej) => { - // Get 'gameId' parameter - const [gameId, gameIdErr] = $.type(ID).get(params.gameId); - if (gameIdErr) return rej('invalid gameId param'); - - const game = await OthelloGame.findOne({ _id: gameId }); - - if (game == null) { - return rej('game not found'); - } - - const o = new Othello(game.settings.map, { - isLlotheo: game.settings.isLlotheo, - canPutEverywhere: game.settings.canPutEverywhere, - loopedBoard: game.settings.loopedBoard - }); - - game.logs.forEach(log => { - o.put(log.color, log.pos); - }); - - const packed = await pack(game, user); - - res(Object.assign({ - board: o.board, - turn: o.turn - }, packed)); -}); -- cgit v1.2.3-freya