mirror of
https://github.com/sim1222/misskey.git
synced 2025-07-28 22:09:53 +09:00
Update dependencies 🚀
This commit is contained in:
@ -13,15 +13,15 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Lookup note
|
||||
|
@ -14,23 +14,23 @@ import { IApp } from '../../../../models/app';
|
||||
*/
|
||||
module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
||||
// Get 'visibility' parameter
|
||||
const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).$;
|
||||
const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).get();
|
||||
if (visibilityErr) return rej('invalid visibility');
|
||||
|
||||
// Get 'text' parameter
|
||||
const [text = null, textErr] = $(params.text).optional.nullable.string().pipe(isValidText).$;
|
||||
const [text = null, textErr] = $(params.text).optional.nullable.string().pipe(isValidText).get();
|
||||
if (textErr) return rej('invalid text');
|
||||
|
||||
// Get 'cw' parameter
|
||||
const [cw, cwErr] = $(params.cw).optional.nullable.string().pipe(isValidCw).$;
|
||||
const [cw, cwErr] = $(params.cw).optional.nullable.string().pipe(isValidCw).get();
|
||||
if (cwErr) return rej('invalid cw');
|
||||
|
||||
// Get 'viaMobile' parameter
|
||||
const [viaMobile = false, viaMobileErr] = $(params.viaMobile).optional.boolean().$;
|
||||
const [viaMobile = false, viaMobileErr] = $(params.viaMobile).optional.boolean().get();
|
||||
if (viaMobileErr) return rej('invalid viaMobile');
|
||||
|
||||
// Get 'tags' parameter
|
||||
const [tags = [], tagsErr] = $(params.tags).optional.array($().string().range(1, 32)).unique().$;
|
||||
const [tags = [], tagsErr] = $(params.tags).optional.array($().string().range(1, 32)).unique().get();
|
||||
if (tagsErr) return rej('invalid tags');
|
||||
|
||||
// Get 'geo' parameter
|
||||
@ -43,11 +43,11 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
||||
.have('altitudeAccuracy', $().nullable.number())
|
||||
.have('heading', $().nullable.number().range(0, 360))
|
||||
.have('speed', $().nullable.number())
|
||||
.$;
|
||||
.get();
|
||||
if (geoErr) return rej('invalid geo');
|
||||
|
||||
// Get 'mediaIds' parameter
|
||||
const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array($().type(ID)).unique().range(1, 4).$;
|
||||
const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array($().type(ID)).unique().range(1, 4).get();
|
||||
if (mediaIdsErr) return rej('invalid mediaIds');
|
||||
|
||||
let files = [];
|
||||
@ -74,7 +74,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
||||
}
|
||||
|
||||
// Get 'renoteId' parameter
|
||||
const [renoteId, renoteIdErr] = $(params.renoteId).optional.type(ID).$;
|
||||
const [renoteId, renoteIdErr] = $(params.renoteId).optional.type(ID).get();
|
||||
if (renoteIdErr) return rej('invalid renoteId');
|
||||
|
||||
let renote: INote = null;
|
||||
@ -95,7 +95,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
||||
}
|
||||
|
||||
// Get 'replyId' parameter
|
||||
const [replyId, replyIdErr] = $(params.replyId).optional.type(ID).$;
|
||||
const [replyId, replyIdErr] = $(params.replyId).optional.type(ID).get();
|
||||
if (replyIdErr) return rej('invalid replyId');
|
||||
|
||||
let reply: INote = null;
|
||||
@ -116,7 +116,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
||||
}
|
||||
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $(params.channelId).optional.type(ID).$;
|
||||
const [channelId, channelIdErr] = $(params.channelId).optional.type(ID).get();
|
||||
if (channelIdErr) return rej('invalid channelId');
|
||||
|
||||
let channel: IChannel = null;
|
||||
@ -162,7 +162,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
||||
.unique()
|
||||
.range(2, 10)
|
||||
.each(c => c.length > 0 && c.length < 50))
|
||||
.$;
|
||||
.get();
|
||||
if (pollErr) return rej('invalid poll');
|
||||
|
||||
if (poll) {
|
||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get favoritee
|
||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get favoritee
|
||||
|
@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = async (params, user, app) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) throw 'invalid limit param';
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) throw 'invalid sinceId param';
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) throw 'invalid untilId param';
|
||||
|
||||
// Get 'sinceDate' parameter
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||
|
||||
// Get 'untilDate' parameter
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||
if (untilDateErr) throw 'invalid untilDate param';
|
||||
|
||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||
|
@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = async (params, user, app) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) throw 'invalid limit param';
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) throw 'invalid sinceId param';
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) throw 'invalid untilId param';
|
||||
|
||||
// Get 'sinceDate' parameter
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||
|
||||
// Get 'untilDate' parameter
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||
if (untilDateErr) throw 'invalid untilDate param';
|
||||
|
||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||
|
@ -16,19 +16,19 @@ import { pack } from '../../../../models/note';
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'following' parameter
|
||||
const [following = false, followingError] =
|
||||
$(params.following).optional.boolean().$;
|
||||
$(params.following).optional.boolean().get();
|
||||
if (followingError) return rej('invalid following param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -10,11 +10,11 @@ import Note, { pack } from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get votes
|
||||
|
@ -14,7 +14,7 @@ import notify from '../../../../../publishers/notify';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get votee
|
||||
@ -34,7 +34,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const [choice, choiceError] =
|
||||
$(params.choice).number()
|
||||
.pipe(c => note.poll.choices.some(x => x.id == c))
|
||||
.$;
|
||||
.get();
|
||||
if (choiceError) return rej('invalid choice param');
|
||||
|
||||
// if already voted
|
||||
|
@ -14,19 +14,19 @@ import Reaction, { pack } from '../../../../models/note-reaction';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get 'sort' parameter
|
||||
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').$;
|
||||
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
|
||||
if (sortError) return rej('invalid sort param');
|
||||
|
||||
// Lookup note
|
||||
|
@ -11,11 +11,11 @@ import { validateReaction } from '../../../../../models/note-reaction';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'reaction' parameter
|
||||
const [reaction, reactionErr] = $(params.reaction).string().pipe(validateReaction.ok).$;
|
||||
const [reaction, reactionErr] = $(params.reaction).string().pipe(validateReaction.ok).get();
|
||||
if (reactionErr) return rej('invalid reaction param');
|
||||
|
||||
// Fetch reactee
|
||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Fetch unreactee
|
||||
|
@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get 'sort' parameter
|
||||
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').$;
|
||||
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
|
||||
if (sortError) return rej('invalid sort param');
|
||||
|
||||
// Lookup note
|
||||
|
@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -18,63 +18,63 @@ import { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||
// Get 'text' parameter
|
||||
const [text, textError] = $(params.text).optional.string().$;
|
||||
const [text, textError] = $(params.text).optional.string().get();
|
||||
if (textError) return rej('invalid text param');
|
||||
|
||||
// Get 'includeUserIds' parameter
|
||||
const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array($().type(ID)).$;
|
||||
const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array($().type(ID)).get();
|
||||
if (includeUserIdsErr) return rej('invalid includeUserIds param');
|
||||
|
||||
// Get 'excludeUserIds' parameter
|
||||
const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array($().type(ID)).$;
|
||||
const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array($().type(ID)).get();
|
||||
if (excludeUserIdsErr) return rej('invalid excludeUserIds param');
|
||||
|
||||
// Get 'includeUserUsernames' parameter
|
||||
const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array($().string()).$;
|
||||
const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array($().string()).get();
|
||||
if (includeUserUsernamesErr) return rej('invalid includeUserUsernames param');
|
||||
|
||||
// Get 'excludeUserUsernames' parameter
|
||||
const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array($().string()).$;
|
||||
const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array($().string()).get();
|
||||
if (excludeUserUsernamesErr) return rej('invalid excludeUserUsernames param');
|
||||
|
||||
// Get 'following' parameter
|
||||
const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$;
|
||||
const [following = null, followingErr] = $(params.following).optional.nullable.boolean().get();
|
||||
if (followingErr) return rej('invalid following param');
|
||||
|
||||
// Get 'mute' parameter
|
||||
const [mute = 'mute_all', muteErr] = $(params.mute).optional.string().$;
|
||||
const [mute = 'mute_all', muteErr] = $(params.mute).optional.string().get();
|
||||
if (muteErr) return rej('invalid mute param');
|
||||
|
||||
// Get 'reply' parameter
|
||||
const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().$;
|
||||
const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().get();
|
||||
if (replyErr) return rej('invalid reply param');
|
||||
|
||||
// Get 'renote' parameter
|
||||
const [renote = null, renoteErr] = $(params.renote).optional.nullable.boolean().$;
|
||||
const [renote = null, renoteErr] = $(params.renote).optional.nullable.boolean().get();
|
||||
if (renoteErr) return rej('invalid renote param');
|
||||
|
||||
// Get 'media' parameter
|
||||
const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().$;
|
||||
const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().get();
|
||||
if (mediaErr) return rej('invalid media param');
|
||||
|
||||
// Get 'poll' parameter
|
||||
const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().$;
|
||||
const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().get();
|
||||
if (pollErr) return rej('invalid poll param');
|
||||
|
||||
// Get 'sinceDate' parameter
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||
|
||||
// Get 'untilDate' parameter
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||
if (untilDateErr) throw 'invalid untilDate param';
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 30).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 30).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
let includeUsers = includeUserIds;
|
||||
|
@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get note
|
||||
|
@ -13,23 +13,23 @@ import { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = async (params, user, app) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) throw 'invalid limit param';
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) throw 'invalid sinceId param';
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) throw 'invalid untilId param';
|
||||
|
||||
// Get 'sinceDate' parameter
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||
|
||||
// Get 'untilDate' parameter
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||
if (untilDateErr) throw 'invalid untilDate param';
|
||||
|
||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||
@ -38,11 +38,11 @@ module.exports = async (params, user, app) => {
|
||||
}
|
||||
|
||||
// Get 'includeMyRenotes' parameter
|
||||
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().$;
|
||||
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().get();
|
||||
if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
|
||||
|
||||
// Get 'includeRenotedMyNotes' parameter
|
||||
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().$;
|
||||
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().get();
|
||||
if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
|
||||
|
||||
const [followings, watchingChannelIds, mutedUserIds] = await Promise.all([
|
||||
|
@ -14,27 +14,27 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get 'reply' parameter
|
||||
const [reply, replyErr] = $(params.reply).optional.boolean().$;
|
||||
const [reply, replyErr] = $(params.reply).optional.boolean().get();
|
||||
if (replyErr) return rej('invalid reply param');
|
||||
|
||||
// Get 'renote' parameter
|
||||
const [renote, renoteErr] = $(params.renote).optional.boolean().$;
|
||||
const [renote, renoteErr] = $(params.renote).optional.boolean().get();
|
||||
if (renoteErr) return rej('invalid renote param');
|
||||
|
||||
// Get 'media' parameter
|
||||
const [media, mediaErr] = $(params.media).optional.boolean().$;
|
||||
const [media, mediaErr] = $(params.media).optional.boolean().get();
|
||||
if (mediaErr) return rej('invalid media param');
|
||||
|
||||
// Get 'poll' parameter
|
||||
const [poll, pollErr] = $(params.poll).optional.boolean().$;
|
||||
const [poll, pollErr] = $(params.poll).optional.boolean().get();
|
||||
if (pollErr) return rej('invalid poll param');
|
||||
|
||||
const query = {
|
||||
|
@ -12,23 +12,23 @@ import UserList from '../../../../models/user-list';
|
||||
*/
|
||||
module.exports = async (params, user, app) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
if (limitErr) throw 'invalid limit param';
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
if (sinceIdErr) throw 'invalid sinceId param';
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
if (untilIdErr) throw 'invalid untilId param';
|
||||
|
||||
// Get 'sinceDate' parameter
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||
|
||||
// Get 'untilDate' parameter
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||
if (untilDateErr) throw 'invalid untilDate param';
|
||||
|
||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||
@ -37,15 +37,15 @@ module.exports = async (params, user, app) => {
|
||||
}
|
||||
|
||||
// Get 'includeMyRenotes' parameter
|
||||
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().$;
|
||||
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().get();
|
||||
if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
|
||||
|
||||
// Get 'includeRenotedMyNotes' parameter
|
||||
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().$;
|
||||
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().get();
|
||||
if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
|
||||
|
||||
// Get 'listId' parameter
|
||||
const [listId, listIdErr] = $(params.listId).type(ID).$;
|
||||
const [listId, listIdErr] = $(params.listId).type(ID).get();
|
||||
if (listIdErr) throw 'invalid listId param';
|
||||
|
||||
const [list, mutedUserIds] = await Promise.all([
|
||||
|
Reference in New Issue
Block a user