summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/channels
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/channels
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/channels')
-rw-r--r--src/server/api/endpoints/channels/create.ts2
-rw-r--r--src/server/api/endpoints/channels/notes.ts8
-rw-r--r--src/server/api/endpoints/channels/show.ts2
-rw-r--r--src/server/api/endpoints/channels/unwatch.ts2
-rw-r--r--src/server/api/endpoints/channels/watch.ts2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/server/api/endpoints/channels/create.ts b/src/server/api/endpoints/channels/create.ts
index 2574e0923d..0e3c9dc5ac 100644
--- a/src/server/api/endpoints/channels/create.ts
+++ b/src/server/api/endpoints/channels/create.ts
@@ -11,7 +11,7 @@ import { pack } from '../../../../models/channel';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'title' parameter
- const [title, titleErr] = $(params.title).string().range(1, 100).get();
+ const [title, titleErr] = $.str.range(1, 100).get(params.title);
if (titleErr) return rej('invalid title param');
// Create a channel
diff --git a/src/server/api/endpoints/channels/notes.ts b/src/server/api/endpoints/channels/notes.ts
index a83cdb34c4..463152e74a 100644
--- a/src/server/api/endpoints/channels/notes.ts
+++ b/src/server/api/endpoints/channels/notes.ts
@@ -10,15 +10,15 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
- const [limit = 1000, limitErr] = $(params.limit).optional.number().range(1, 1000).get();
+ const [limit = 1000, limitErr] = $.num.optional().range(1, 1000).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
@@ -27,7 +27,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'channelId' parameter
- const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
+ const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
if (channelIdErr) return rej('invalid channelId param');
// Fetch channel
diff --git a/src/server/api/endpoints/channels/show.ts b/src/server/api/endpoints/channels/show.ts
index d5ca4ba3b7..1bba63d490 100644
--- a/src/server/api/endpoints/channels/show.ts
+++ b/src/server/api/endpoints/channels/show.ts
@@ -9,7 +9,7 @@ import Channel, { IChannel, pack } from '../../../../models/channel';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
- const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
+ const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
if (channelIdErr) return rej('invalid channelId param');
// Fetch channel
diff --git a/src/server/api/endpoints/channels/unwatch.ts b/src/server/api/endpoints/channels/unwatch.ts
index 9385e209df..f7dddff461 100644
--- a/src/server/api/endpoints/channels/unwatch.ts
+++ b/src/server/api/endpoints/channels/unwatch.ts
@@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
- const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
+ const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
if (channelIdErr) return rej('invalid channelId param');
//#region Fetch channel
diff --git a/src/server/api/endpoints/channels/watch.ts b/src/server/api/endpoints/channels/watch.ts
index ceda3b130a..34243ff68b 100644
--- a/src/server/api/endpoints/channels/watch.ts
+++ b/src/server/api/endpoints/channels/watch.ts
@@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
- const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
+ const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
if (channelIdErr) return rej('invalid channelId param');
//#region Fetch channel