diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-06-17 08:10:54 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-06-17 08:10:54 +0900 |
| commit | 1ef66c962a1cea81dee4f5db32cd011feac7de44 (patch) | |
| tree | 006945b7ae9d437cebb0fabc5eb5a849cff518c5 /src/server/api/endpoints | |
| parent | Add missing semicolon (diff) | |
| download | sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.gz sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.bz2 sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.zip | |
reversi :white_flower: :100:
Diffstat (limited to 'src/server/api/endpoints')
| -rw-r--r-- | src/server/api/endpoints/reversi/games.ts (renamed from src/server/api/endpoints/othello/games.ts) | 4 | ||||
| -rw-r--r-- | src/server/api/endpoints/reversi/games/show.ts (renamed from src/server/api/endpoints/othello/games/show.ts) | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/reversi/invitations.ts (renamed from src/server/api/endpoints/othello/invitations.ts) | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/reversi/match.ts (renamed from src/server/api/endpoints/othello/match.ts) | 18 | ||||
| -rw-r--r-- | src/server/api/endpoints/reversi/match/cancel.ts (renamed from src/server/api/endpoints/othello/match/cancel.ts) | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/src/server/api/endpoints/othello/games.ts b/src/server/api/endpoints/reversi/games.ts index 2320a34b04..9d879ecf23 100644 --- a/src/server/api/endpoints/othello/games.ts +++ b/src/server/api/endpoints/reversi/games.ts @@ -1,5 +1,5 @@ import $ from 'cafy'; import ID from '../../../../cafy-id'; -import OthelloGame, { pack } from '../../../../models/othello-game'; +import ReversiGame, { pack } from '../../../../models/reversi-game'; module.exports = (params, user) => new Promise(async (res, rej) => { // Get 'my' parameter @@ -50,7 +50,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } // Fetch games - const games = await OthelloGame.find(q, { + const games = await ReversiGame.find(q, { sort, limit }); diff --git a/src/server/api/endpoints/othello/games/show.ts b/src/server/api/endpoints/reversi/games/show.ts index 6b2f5ce137..f32eb23513 100644 --- a/src/server/api/endpoints/othello/games/show.ts +++ b/src/server/api/endpoints/reversi/games/show.ts @@ -1,19 +1,19 @@ import $ from 'cafy'; import ID from '../../../../../cafy-id'; -import OthelloGame, { pack } from '../../../../../models/othello-game'; -import Othello from '../../../../../othello/core'; +import ReversiGame, { pack } from '../../../../../models/reversi-game'; +import Reversi from '../../../../../reversi/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 }); + const game = await ReversiGame.findOne({ _id: gameId }); if (game == null) { return rej('game not found'); } - const o = new Othello(game.settings.map, { + const o = new Reversi(game.settings.map, { isLlotheo: game.settings.isLlotheo, canPutEverywhere: game.settings.canPutEverywhere, loopedBoard: game.settings.loopedBoard diff --git a/src/server/api/endpoints/othello/invitations.ts b/src/server/api/endpoints/reversi/invitations.ts index 4761537614..fc487205a9 100644 --- a/src/server/api/endpoints/othello/invitations.ts +++ b/src/server/api/endpoints/reversi/invitations.ts @@ -1,4 +1,4 @@ -import Matching, { pack as packMatching } from '../../../../models/othello-matching'; +import Matching, { pack as packMatching } from '../../../../models/reversi-matching'; module.exports = (params, user) => new Promise(async (res, rej) => { // Find session diff --git a/src/server/api/endpoints/othello/match.ts b/src/server/api/endpoints/reversi/match.ts index e70e579755..5a699ddbae 100644 --- a/src/server/api/endpoints/othello/match.ts +++ b/src/server/api/endpoints/reversi/match.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import ID from '../../../../cafy-id'; -import Matching, { pack as packMatching } from '../../../../models/othello-matching'; -import OthelloGame, { pack as packGame } from '../../../../models/othello-game'; +import Matching, { pack as packMatching } from '../../../../models/reversi-matching'; +import ReversiGame, { pack as packGame } from '../../../../models/reversi-game'; import User from '../../../../models/user'; -import publishUserStream, { publishOthelloStream } from '../../../../publishers/stream'; -import { eighteight } from '../../../../othello/maps'; +import publishUserStream, { publishReversiStream } from '../../../../publishers/stream'; +import { eighteight } from '../../../../reversi/maps'; module.exports = (params, user) => new Promise(async (res, rej) => { // Get 'userId' parameter @@ -28,7 +28,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Create game - const game = await OthelloGame.insert({ + const game = await ReversiGame.insert({ createdAt: new Date(), user1Id: exist.parentId, user2Id: user._id, @@ -47,14 +47,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Reponse res(await packGame(game, user)); - publishOthelloStream(exist.parentId, 'matched', await packGame(game, exist.parentId)); + publishReversiStream(exist.parentId, 'matched', await packGame(game, exist.parentId)); const other = await Matching.count({ childId: user._id }); if (other == 0) { - publishUserStream(user._id, 'othello_no_invites'); + publishUserStream(user._id, 'reversi_no_invites'); } } else { // Fetch child @@ -88,8 +88,8 @@ module.exports = (params, user) => new Promise(async (res, rej) => { const packed = await packMatching(matching, child); // 招待 - publishOthelloStream(child._id, 'invited', packed); + publishReversiStream(child._id, 'invited', packed); - publishUserStream(child._id, 'othello_invited', packed); + publishUserStream(child._id, 'reversi_invited', packed); } }); diff --git a/src/server/api/endpoints/othello/match/cancel.ts b/src/server/api/endpoints/reversi/match/cancel.ts index 562e691061..bc8a4cd640 100644 --- a/src/server/api/endpoints/othello/match/cancel.ts +++ b/src/server/api/endpoints/reversi/match/cancel.ts @@ -1,4 +1,4 @@ -import Matching from '../../../../../models/othello-matching'; +import Matching from '../../../../../models/reversi-matching'; module.exports = (params, user) => new Promise(async (res, rej) => { await Matching.remove({ |