diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-28 16:39:14 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-28 16:39:14 +0900 |
| commit | 3d5cdb8d2d60932caf1d29b0581c7d6243e06e37 (patch) | |
| tree | 9c29d1062b08378d4c4cafe5976793616d45bc01 /src/api/endpoints/othello | |
| parent | wip (diff) | |
| download | sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.gz sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.bz2 sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.zip | |
wip
Diffstat (limited to 'src/api/endpoints/othello')
| -rw-r--r-- | src/api/endpoints/othello/games.ts | 8 | ||||
| -rw-r--r-- | src/api/endpoints/othello/games/show.ts | 6 | ||||
| -rw-r--r-- | src/api/endpoints/othello/invitations.ts | 2 | ||||
| -rw-r--r-- | src/api/endpoints/othello/match.ts | 40 | ||||
| -rw-r--r-- | src/api/endpoints/othello/match/cancel.ts | 2 |
5 files changed, 29 insertions, 29 deletions
diff --git a/src/api/endpoints/othello/games.ts b/src/api/endpoints/othello/games.ts index f6e38b8d87..5c71f98828 100644 --- a/src/api/endpoints/othello/games.ts +++ b/src/api/endpoints/othello/games.ts @@ -24,14 +24,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } const q: any = my ? { - is_started: true, + isStarted: true, $or: [{ - user1_id: user._id + user1Id: user._id }, { - user2_id: user._id + user2Id: user._id }] } : { - is_started: true + isStarted: true }; const sort = { diff --git a/src/api/endpoints/othello/games/show.ts b/src/api/endpoints/othello/games/show.ts index c7bd74a39a..19f5d0fef0 100644 --- a/src/api/endpoints/othello/games/show.ts +++ b/src/api/endpoints/othello/games/show.ts @@ -14,9 +14,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } const o = new Othello(game.settings.map, { - isLlotheo: game.settings.is_llotheo, - canPutEverywhere: game.settings.can_put_everywhere, - loopedBoard: game.settings.looped_board + isLlotheo: game.settings.isLlotheo, + canPutEverywhere: game.settings.canPutEverywhere, + loopedBoard: game.settings.loopedBoard }); game.logs.forEach(log => { diff --git a/src/api/endpoints/othello/invitations.ts b/src/api/endpoints/othello/invitations.ts index 02fb421fbc..f6e0071a6c 100644 --- a/src/api/endpoints/othello/invitations.ts +++ b/src/api/endpoints/othello/invitations.ts @@ -3,7 +3,7 @@ import Matching, { pack as packMatching } from '../../models/othello-matching'; module.exports = (params, user) => new Promise(async (res, rej) => { // Find session const invitations = await Matching.find({ - child_id: user._id + childId: user._id }, { sort: { _id: -1 diff --git a/src/api/endpoints/othello/match.ts b/src/api/endpoints/othello/match.ts index f73386ba7c..f503c5834c 100644 --- a/src/api/endpoints/othello/match.ts +++ b/src/api/endpoints/othello/match.ts @@ -6,19 +6,19 @@ import publishUserStream, { publishOthelloStream } from '../../event'; import { eighteight } from '../../../common/othello/maps'; module.exports = (params, user) => new Promise(async (res, rej) => { - // Get 'user_id' parameter - const [childId, childIdErr] = $(params.user_id).id().$; - if (childIdErr) return rej('invalid user_id param'); + // Get 'userId' parameter + const [childId, childIdErr] = $(params.userId).id().$; + if (childIdErr) return rej('invalid userId param'); // Myself if (childId.equals(user._id)) { - return rej('invalid user_id param'); + return rej('invalid userId param'); } // Find session const exist = await Matching.findOne({ - parent_id: childId, - child_id: user._id + parentId: childId, + childId: user._id }); if (exist) { @@ -29,28 +29,28 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Create game const game = await OthelloGame.insert({ - created_at: new Date(), - user1_id: exist.parent_id, - user2_id: user._id, - user1_accepted: false, - user2_accepted: false, - is_started: false, - is_ended: false, + createdAt: new Date(), + user1Id: exist.parentId, + user2Id: user._id, + user1Accepted: false, + user2Accepted: false, + isStarted: false, + isEnded: false, logs: [], settings: { map: eighteight.data, bw: 'random', - is_llotheo: false + isLlotheo: false } }); // Reponse res(await packGame(game, user)); - publishOthelloStream(exist.parent_id, 'matched', await packGame(game, exist.parent_id)); + publishOthelloStream(exist.parentId, 'matched', await packGame(game, exist.parentId)); const other = await Matching.count({ - child_id: user._id + childId: user._id }); if (other == 0) { @@ -72,14 +72,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // 以前のセッションはすべて削除しておく await Matching.remove({ - parent_id: user._id + parentId: user._id }); // セッションを作成 const matching = await Matching.insert({ - created_at: new Date(), - parent_id: user._id, - child_id: child._id + createdAt: new Date(), + parentId: user._id, + childId: child._id }); // Reponse diff --git a/src/api/endpoints/othello/match/cancel.ts b/src/api/endpoints/othello/match/cancel.ts index 6f751ef835..ee0f82a611 100644 --- a/src/api/endpoints/othello/match/cancel.ts +++ b/src/api/endpoints/othello/match/cancel.ts @@ -2,7 +2,7 @@ import Matching from '../../../models/othello-matching'; module.exports = (params, user) => new Promise(async (res, rej) => { await Matching.remove({ - parent_id: user._id + parentId: user._id }); res(); |