This commit is contained in:
syuilo
2018-03-07 18:45:16 +09:00
parent 161fd4afab
commit 0bca0e8a02
7 changed files with 124 additions and 56 deletions

View File

@@ -3,7 +3,7 @@ import Game, { pack } from '../../models/othello-game';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'my' parameter
const [my = false, myErr] = $(params.my).boolean().$;
const [my = false, myErr] = $(params.my).optional.boolean().$;
if (myErr) return rej('invalid my param');
const q = my ? {

View File

@@ -34,6 +34,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
black_user_id: parentIsBlack ? exist.parent_id : user._id,
white_user_id: parentIsBlack ? user._id : exist.parent_id,
turn_user_id: parentIsBlack ? exist.parent_id : user._id,
is_ended: false,
logs: []
});