This commit is contained in:
syuilo
2018-07-05 23:36:07 +09:00
parent d53d45f797
commit 11439afde7
54 changed files with 260 additions and 260 deletions

View File

@ -8,27 +8,27 @@ import { ILocalUser } from '../../../../models/user';
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $.num.optional().min(0).get(params.offset);
const [offset = 0, offsetErr] = $.num.optional.min(0).get(params.offset);
if (offsetErr) return rej('invalid offset param');
// Get 'reply' parameter
const [reply, replyErr] = $.bool.optional().get(params.reply);
const [reply, replyErr] = $.bool.optional.get(params.reply);
if (replyErr) return rej('invalid reply param');
// Get 'renote' parameter
const [renote, renoteErr] = $.bool.optional().get(params.renote);
const [renote, renoteErr] = $.bool.optional.get(params.renote);
if (renoteErr) return rej('invalid renote param');
// Get 'media' parameter
const [media, mediaErr] = $.bool.optional().get(params.media);
const [media, mediaErr] = $.bool.optional.get(params.media);
if (mediaErr) return rej('invalid media param');
// Get 'poll' parameter
const [poll, pollErr] = $.bool.optional().get(params.poll);
const [poll, pollErr] = $.bool.optional.get(params.poll);
if (pollErr) return rej('invalid poll param');
const query = {