Use any instead of Object

This commit is contained in:
Aya Morisawa 2017-03-01 17:37:01 +09:00
parent d2c70afd37
commit ac8eb94a27
81 changed files with 398 additions and 397 deletions

View File

@ -10,8 +10,8 @@ import Like from '../../../models/like';
/** /**
* Aggregate like of a post * Aggregate like of a post
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import Like from '../../../models/like';
/** /**
* Aggregate likes of a post * Aggregate likes of a post
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -9,8 +9,8 @@ import Post from '../../../models/post';
/** /**
* Aggregate reply of a post * Aggregate reply of a post
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -9,8 +9,8 @@ import Post from '../../../models/post';
/** /**
* Aggregate repost of a post * Aggregate repost of a post
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import Following from '../../../models/following';
/** /**
* Aggregate followers of a user * Aggregate followers of a user
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import Following from '../../../models/following';
/** /**
* Aggregate following of a user * Aggregate following of a user
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import Like from '../../../models/like';
/** /**
* Aggregate like of a user * Aggregate like of a user
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import Post from '../../../models/post';
/** /**
* Aggregate post of a user * Aggregate post of a user
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -63,9 +63,9 @@ import serialize from '../../serializers/app';
/** /**
* Create an app * Create an app
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = async (params, user) => module.exports = async (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -37,8 +37,8 @@ import App from '../../../models/app';
/** /**
* Check available name_id of app * Check available name_id of app
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = async (params) => module.exports = async (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -40,11 +40,11 @@ import serialize from '../../serializers/app';
/** /**
* Show an app * Show an app
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} _ * @param {any} _
* @param {Object} isSecure * @param {any} isSecure
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, _, isSecure) => module.exports = (params, user, _, isSecure) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -35,9 +35,9 @@ import AccessToken from '../../models/access-token';
/** /**
* Accept * Accept
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -42,8 +42,8 @@ import config from '../../../../conf';
/** /**
* Generate a session * Generate a session
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -49,9 +49,9 @@ import serialize from '../../../serializers/auth-session';
/** /**
* Show a session * Show a session
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -47,8 +47,8 @@ import serialize from '../../../serializers/user';
/** /**
* Generate a session * Generate a session
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -8,24 +8,27 @@ import DriveFile from '../models/drive-file';
/** /**
* Get drive information * Get drive information
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Calculate drive usage // Calculate drive usage
const usage = ((await DriveFile const usage = ((await DriveFile
.aggregate([ .aggregate([
{ $match: { user_id: user._id } }, { $match: { user_id: user._id } },
{ $project: { {
$project: {
datasize: true datasize: true
}}, }
{ $group: { },
{
$group: {
_id: null, _id: null,
usage: { $sum: '$datasize' } usage: { $sum: '$datasize' }
}} }
}
]))[0] || { ]))[0] || {
usage: 0 usage: 0
}).usage; }).usage;
@ -34,4 +37,4 @@ module.exports = (params, user) =>
capacity: user.drive_capacity, capacity: user.drive_capacity,
usage: usage usage: usage
}); });
}); });

View File

@ -10,10 +10,10 @@ import serialize from '../../serializers/drive-file';
/** /**
* Get drive files * Get drive files
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app) => module.exports = (params, user, app) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -14,10 +14,10 @@ import create from '../../../common/add-file-to-drive';
/** /**
* Create a file * Create a file
* *
* @param {Object} file * @param {any} file
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (file, params, user) => module.exports = (file, params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-file';
/** /**
* Find a file(s) * Find a file(s)
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-file';
/** /**
* Show a file * Show a file
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -13,9 +13,9 @@ import event from '../../../event';
/** /**
* Update a file * Update a file
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -15,9 +15,9 @@ import create from '../../../common/add-file-to-drive';
/** /**
* Create a file from a URL * Create a file from a URL
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,10 +10,10 @@ import serialize from '../../serializers/drive-folder';
/** /**
* Get drive folders * Get drive folders
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app) => module.exports = (params, user, app) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import event from '../../../event';
/** /**
* Create drive folder * Create drive folder
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-folder';
/** /**
* Find a folder(s) * Find a folder(s)
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-folder';
/** /**
* Show a folder * Show a folder
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import event from '../../../event';
/** /**
* Update a folder * Update a folder
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/drive-file';
/** /**
* Get drive stream * Get drive stream
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -13,9 +13,9 @@ import serializeUser from '../../serializers/user';
/** /**
* Follow a user * Follow a user
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import serializeUser from '../../serializers/user';
/** /**
* Unfollow a user * Unfollow a user
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -8,11 +8,11 @@ import serialize from '../serializers/user';
/** /**
* Show myself * Show myself
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @param {Boolean} isSecure * @param {Boolean} isSecure
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, _, isSecure) => module.exports = (params, user, _, isSecure) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -8,11 +8,11 @@ import Appdata from '../../../models/appdata';
/** /**
* Get app data * Get app data
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @param {Boolean} isSecure * @param {Boolean} isSecure
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app, isSecure) => module.exports = (params, user, app, isSecure) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,11 +11,11 @@ import event from '../../../event';
/** /**
* Set app data * Set app data
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @param {Boolean} isSecure * @param {Boolean} isSecure
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app, isSecure) => module.exports = (params, user, app, isSecure) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/app';
/** /**
* Get authorized apps of my account * Get authorized apps of my account
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,8 +10,8 @@ import serialize from '../../serializers/post';
/** /**
* Get followers of a user * Get followers of a user
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,9 +11,9 @@ import getFriends from '../../common/get-friends';
/** /**
* Get notifications * Get notifications
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/signin';
/** /**
* Get signin history of my account * Get signin history of my account
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -13,11 +13,11 @@ import config from '../../../conf';
/** /**
* Update myself * Update myself
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} _ * @param {any} _
* @param {boolean} isSecure * @param {boolean} isSecure
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = async (params, user, _, isSecure) => module.exports = async (params, user, _, isSecure) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/messaging-message';
/** /**
* Show messaging history * Show messaging history
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -13,9 +13,9 @@ import { publishMessagingStream } from '../../event';
/** /**
* Get messages * Get messages
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -21,9 +21,9 @@ const maxTextLength = 500;
/** /**
* Create a message * Create a message
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -8,9 +8,9 @@ import Message from '../../models/messaging-message';
/** /**
* Get count of unread messages * Get count of unread messages
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -36,8 +36,8 @@ import git from 'git-last-commit';
/** /**
* Show core info * Show core info
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/app';
/** /**
* Get my apps * Get my apps
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,9 +11,9 @@ import event from '../../../event';
/** /**
* Mark as read a notification * Mark as read a notification
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -9,12 +9,11 @@ import serialize from '../serializers/post';
/** /**
* Lists all posts * Lists all posts
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params) => module.exports = (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'include_replies' parameter // Get 'include_replies' parameter
let includeReplies = params.include_replies; let includeReplies = params.include_replies;
if (includeReplies === true) { if (includeReplies === true) {
@ -85,4 +84,4 @@ module.exports = (params) =>
// Serialize // Serialize
res(await Promise.all(posts.map(async post => await serialize(post)))); res(await Promise.all(posts.map(async post => await serialize(post))));
}); });

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/post';
/** /**
* Show a context of a post * Show a context of a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -28,10 +28,10 @@ const maxMediaCount = 4;
/** /**
* Create a post * Create a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app) => module.exports = (params, user, app) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import Post from '../../models/post';
/** /**
* Favorite a post * Favorite a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -10,9 +10,9 @@ import Post from '../../models/post';
/** /**
* Unfavorite a post * Unfavorite a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -11,9 +11,9 @@ import serialize from '../../serializers/user';
/** /**
* Show a likes of a post * Show a likes of a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import notify from '../../../common/notify';
/** /**
* Like a post * Like a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -12,9 +12,9 @@ import User from '../../../models/user';
/** /**
* Unlike a post * Unlike a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -11,9 +11,9 @@ import serialize from '../../serializers/post';
/** /**
* Get mentions of myself * Get mentions of myself
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,9 +11,9 @@ import notify from '../../../common/notify';
/** /**
* Vote poll of a post * Vote poll of a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => { new Promise(async (res, rej) => {

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/post';
/** /**
* Show a replies of a post * Show a replies of a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/post';
/** /**
* Show a reposts of a post * Show a reposts of a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import config from '../../../conf';
/** /**
* Search a post * Search a post
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/post';
/** /**
* Show a post * Show a post
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,10 +11,10 @@ import serialize from '../../serializers/post';
/** /**
* Get timeline of myself * Get timeline of myself
* *
* @param {Object} params * @param {any} params
* @param {Object} user * @param {any} user
* @param {Object} app * @param {any} app
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, user, app) => module.exports = (params, user, app) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -9,8 +9,8 @@ import { validateUsername } from '../../models/user';
/** /**
* Check available username * Check available username
* *
* @param {Object} params * @param {any} params
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = async (params) => module.exports = async (params) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -9,13 +9,12 @@ import serialize from '../serializers/user';
/** /**
* Lists all users * Lists all users
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'limit' parameter // Get 'limit' parameter
let limit = params.limit; let limit = params.limit;
if (limit !== undefined && limit !== null) { if (limit !== undefined && limit !== null) {
@ -63,4 +62,4 @@ module.exports = (params, me) =>
// Serialize // Serialize
res(await Promise.all(users.map(async user => res(await Promise.all(users.map(async user =>
await serialize(user, me)))); await serialize(user, me))));
}); });

View File

@ -12,9 +12,9 @@ import getFriends from '../../common/get-friends';
/** /**
* Get followers of a user * Get followers of a user
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ import getFriends from '../../common/get-friends';
/** /**
* Get following users of a user * Get following users of a user
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -11,9 +11,9 @@ import serialize from '../../serializers/post';
/** /**
* Get posts of a user * Get posts of a user
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import getFriends from '../../common/get-friends';
/** /**
* Get recommended users * Get recommended users
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -12,9 +12,9 @@ const escapeRegexp = require('escape-regexp');
/** /**
* Search a user * Search a user
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/user';
/** /**
* Search a user by username * Search a user by username
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -10,9 +10,9 @@ import serialize from '../../serializers/user';
/** /**
* Show a user * Show a user
* *
* @param {Object} params * @param {any} params
* @param {Object} me * @param {any} me
* @return {Promise<object>} * @return {Promise<any>}
*/ */
module.exports = (params, me) => module.exports = (params, me) =>
new Promise(async (res, rej) => new Promise(async (res, rej) =>

View File

@ -13,7 +13,7 @@ class MisskeyEvent {
config.redis.port, config.redis.host); config.redis.port, config.redis.host);
} }
private publish(channel: string, type: string, value?: Object): void { private publish(channel: string, type: string, value?: any): void {
const message = value == null ? const message = value == null ?
{ type: type } : { type: type } :
{ type: type, body: value }; { type: type, body: value };
@ -21,11 +21,11 @@ class MisskeyEvent {
this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message)); this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message));
} }
public publishUserStream(userId: ID, type: string, value?: Object): void { public publishUserStream(userId: ID, type: string, value?: any): void {
this.publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value);
} }
public publishMessagingStream(userId: ID, otherpartyId: ID, type: string, value?: Object): void { public publishMessagingStream(userId: ID, otherpartyId: ID, type: string, value?: any): void {
this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value); this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
} }
} }

View File

@ -12,10 +12,10 @@ import config from '../../conf';
/** /**
* Serialize an app * Serialize an app
* *
* @param {Object} app * @param {any} app
* @param {Object} me? * @param {any} me?
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
app: any, app: any,

View File

@ -10,9 +10,9 @@ import serializeApp from './app';
/** /**
* Serialize an auth session * Serialize an auth session
* *
* @param {Object} session * @param {any} session
* @param {Object} me? * @param {any} me?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
session: any, session: any,

View File

@ -13,16 +13,16 @@ import config from '../../conf';
/** /**
* Serialize a drive file * Serialize a drive file
* *
* @param {Object} file * @param {any} file
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
file: any, file: any,
options?: { options?: {
detail: boolean detail: boolean
} }
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
const opts = Object.assign({ const opts = Object.assign({
detail: false detail: false
}, options); }, options);

View File

@ -10,16 +10,16 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a drive folder * Serialize a drive folder
* *
* @param {Object} folder * @param {any} folder
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
const self = ( const self = (
folder: any, folder: any,
options?: { options?: {
detail: boolean detail: boolean
} }
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
const opts = Object.assign({ const opts = Object.assign({
detail: false detail: false
}, options); }, options);
@ -28,9 +28,9 @@ const self = (
// Populate the folder if 'folder' is ID // Populate the folder if 'folder' is ID
if (mongo.ObjectID.prototype.isPrototypeOf(folder)) { if (mongo.ObjectID.prototype.isPrototypeOf(folder)) {
_folder = await DriveFolder.findOne({_id: folder}); _folder = await DriveFolder.findOne({ _id: folder });
} else if (typeof folder === 'string') { } else if (typeof folder === 'string') {
_folder = await DriveFolder.findOne({_id: new mongo.ObjectID(folder)}); _folder = await DriveFolder.findOne({ _id: new mongo.ObjectID(folder) });
} else { } else {
_folder = deepcopy(folder); _folder = deepcopy(folder);
} }

View File

@ -10,19 +10,19 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a drive tag * Serialize a drive tag
* *
* @param {Object} tag * @param {any} tag
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
const self = ( const self = (
tag: any tag: any
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
let _tag: any; let _tag: any;
// Populate the tag if 'tag' is ID // Populate the tag if 'tag' is ID
if (mongo.ObjectID.prototype.isPrototypeOf(tag)) { if (mongo.ObjectID.prototype.isPrototypeOf(tag)) {
_tag = await DriveTag.findOne({_id: tag}); _tag = await DriveTag.findOne({ _id: tag });
} else if (typeof tag === 'string') { } else if (typeof tag === 'string') {
_tag = await DriveTag.findOne({_id: new mongo.ObjectID(tag)}); _tag = await DriveTag.findOne({ _id: new mongo.ObjectID(tag) });
} else { } else {
_tag = deepcopy(tag); _tag = deepcopy(tag);
} }

View File

@ -12,10 +12,10 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a message * Serialize a message
* *
* @param {Object} message * @param {any} message
* @param {Object} me? * @param {any} me?
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
message: any, message: any,
@ -23,7 +23,7 @@ export default (
options?: { options?: {
populateRecipient: boolean populateRecipient: boolean
} }
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
const opts = options || { const opts = options || {
populateRecipient: true populateRecipient: true
}; };

View File

@ -12,10 +12,10 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a notification * Serialize a notification
* *
* @param {Object} notification * @param {any} notification
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default (notification: any) => new Promise<Object>(async (resolve, reject) => { export default (notification: any) => new Promise<any>(async (resolve, reject) => {
let _notification: any; let _notification: any;
// Populate the notification if 'notification' is ID // Populate the notification if 'notification' is ID

View File

@ -15,10 +15,10 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a post * Serialize a post
* *
* @param {Object} post * @param {any} post
* @param {Object} me? * @param {any} me?
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
const self = ( const self = (
post: any, post: any,
@ -26,7 +26,7 @@ const self = (
options?: { options?: {
detail: boolean detail: boolean
} }
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
const opts = options || { const opts = options || {
detail: true, detail: true,
}; };

View File

@ -8,12 +8,12 @@ import deepcopy = require('deepcopy');
/** /**
* Serialize a signin record * Serialize a signin record
* *
* @param {Object} record * @param {any} record
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
record: any record: any
) => new Promise<Object>(async (resolve, reject) => { ) => new Promise<any>(async (resolve, reject) => {
const _record = deepcopy(record); const _record = deepcopy(record);

View File

@ -13,10 +13,10 @@ import config from '../../conf';
/** /**
* Serialize a user * Serialize a user
* *
* @param {Object} user * @param {any} user
* @param {Object} me? * @param {any} me?
* @param {Object} options? * @param {any} options?
* @return {Promise<Object>} * @return {Promise<any>}
*/ */
export default ( export default (
user: any, user: any,

View File

@ -11,8 +11,8 @@ let pending = 0;
* Send a request to API * Send a request to API
* @param {string|Object} i Credential * @param {string|Object} i Credential
* @param {string} endpoint Endpoint * @param {string} endpoint Endpoint
* @param {Object} [data={}] Data * @param {any} [data={}] Data
* @return {Promise<Object>} Response * @return {Promise<any>} Response
*/ */
module.exports = (i, endpoint, data = {}) => { module.exports = (i, endpoint, data = {}) => {
if (++pending === 1) { if (++pending === 1) {