summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/othello
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-02 18:06:16 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-02 18:06:16 +0900
commitf664cf09c0860e0cf9920722532c6315fa35a8a1 (patch)
tree119a57cf807ea105a68e14395420f8eb54ab7c5c /src/server/api/endpoints/othello
parentoops (diff)
downloadsharkey-f664cf09c0860e0cf9920722532c6315fa35a8a1.tar.gz
sharkey-f664cf09c0860e0cf9920722532c6315fa35a8a1.tar.bz2
sharkey-f664cf09c0860e0cf9920722532c6315fa35a8a1.zip
Update cafy to 8.0.0 :rocket:
Diffstat (limited to 'src/server/api/endpoints/othello')
-rw-r--r--src/server/api/endpoints/othello/games.ts8
-rw-r--r--src/server/api/endpoints/othello/games/show.ts2
-rw-r--r--src/server/api/endpoints/othello/match.ts2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/server/api/endpoints/othello/games.ts b/src/server/api/endpoints/othello/games.ts
index 05bff180c1..2320a34b04 100644
--- a/src/server/api/endpoints/othello/games.ts
+++ b/src/server/api/endpoints/othello/games.ts
@@ -3,19 +3,19 @@ import OthelloGame, { pack } from '../../../../models/othello-game';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'my' parameter
- const [my = false, myErr] = $(params.my).optional.boolean().get();
+ const [my = false, myErr] = $.bool.optional().get(params.my);
if (myErr) return rej('invalid my param');
// Get 'limit' parameter
- const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
+ const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
- const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
+ const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
- const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
+ const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified
diff --git a/src/server/api/endpoints/othello/games/show.ts b/src/server/api/endpoints/othello/games/show.ts
index 991bb9622e..6b2f5ce137 100644
--- a/src/server/api/endpoints/othello/games/show.ts
+++ b/src/server/api/endpoints/othello/games/show.ts
@@ -4,7 +4,7 @@ import Othello from '../../../../../othello/core';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'gameId' parameter
- const [gameId, gameIdErr] = $(params.gameId).type(ID).get();
+ const [gameId, gameIdErr] = $.type(ID).get(params.gameId);
if (gameIdErr) return rej('invalid gameId param');
const game = await OthelloGame.findOne({ _id: gameId });
diff --git a/src/server/api/endpoints/othello/match.ts b/src/server/api/endpoints/othello/match.ts
index 9769c94da3..e70e579755 100644
--- a/src/server/api/endpoints/othello/match.ts
+++ b/src/server/api/endpoints/othello/match.ts
@@ -7,7 +7,7 @@ import { eighteight } from '../../../../othello/maps';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'userId' parameter
- const [childId, childIdErr] = $(params.userId).type(ID).get();
+ const [childId, childIdErr] = $.type(ID).get(params.userId);
if (childIdErr) return rej('invalid userId param');
// Myself