From ac8eb94a27905a1bcac9fea445b41e5866cf173f Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 1 Mar 2017 17:37:01 +0900 Subject: [PATCH] Use any instead of Object --- src/api/endpoints/aggregation/posts/like.js | 4 +- src/api/endpoints/aggregation/posts/likes.js | 4 +- src/api/endpoints/aggregation/posts/reply.js | 4 +- src/api/endpoints/aggregation/posts/repost.js | 4 +- .../endpoints/aggregation/users/followers.js | 4 +- .../endpoints/aggregation/users/following.js | 4 +- src/api/endpoints/aggregation/users/like.js | 4 +- src/api/endpoints/aggregation/users/post.js | 4 +- src/api/endpoints/app/create.js | 10 +- src/api/endpoints/app/name_id/available.js | 8 +- src/api/endpoints/app/show.js | 14 +- src/api/endpoints/auth/accept.js | 10 +- src/api/endpoints/auth/session/generate.js | 6 +- src/api/endpoints/auth/session/show.js | 10 +- src/api/endpoints/auth/session/userkey.js | 4 +- src/api/endpoints/drive.js | 49 ++++--- src/api/endpoints/drive/files.js | 8 +- src/api/endpoints/drive/files/create.js | 8 +- src/api/endpoints/drive/files/find.js | 6 +- src/api/endpoints/drive/files/show.js | 6 +- src/api/endpoints/drive/files/update.js | 6 +- .../endpoints/drive/files/upload_from_url.js | 6 +- src/api/endpoints/drive/folders.js | 8 +- src/api/endpoints/drive/folders/create.js | 6 +- src/api/endpoints/drive/folders/find.js | 6 +- src/api/endpoints/drive/folders/show.js | 6 +- src/api/endpoints/drive/folders/update.js | 6 +- src/api/endpoints/drive/stream.js | 6 +- src/api/endpoints/following/create.js | 6 +- src/api/endpoints/following/delete.js | 6 +- src/api/endpoints/i.js | 8 +- src/api/endpoints/i/appdata/get.js | 8 +- src/api/endpoints/i/appdata/set.js | 8 +- src/api/endpoints/i/authorized_apps.js | 6 +- src/api/endpoints/i/favorites.js | 4 +- src/api/endpoints/i/notifications.js | 6 +- src/api/endpoints/i/signin_history.js | 6 +- src/api/endpoints/i/update.js | 8 +- src/api/endpoints/messaging/history.js | 6 +- src/api/endpoints/messaging/messages.js | 6 +- .../endpoints/messaging/messages/create.js | 6 +- src/api/endpoints/messaging/unread.js | 6 +- src/api/endpoints/meta.js | 4 +- src/api/endpoints/my/apps.js | 6 +- .../endpoints/notifications/mark_as_read.js | 6 +- src/api/endpoints/posts.js | 131 +++++++++--------- src/api/endpoints/posts/context.js | 6 +- src/api/endpoints/posts/create.js | 8 +- src/api/endpoints/posts/favorites/create.js | 6 +- src/api/endpoints/posts/favorites/delete.js | 6 +- src/api/endpoints/posts/likes.js | 6 +- src/api/endpoints/posts/likes/create.js | 6 +- src/api/endpoints/posts/likes/delete.js | 6 +- src/api/endpoints/posts/mentions.js | 6 +- src/api/endpoints/posts/polls/vote.js | 6 +- src/api/endpoints/posts/replies.js | 6 +- src/api/endpoints/posts/reposts.js | 6 +- src/api/endpoints/posts/search.js | 6 +- src/api/endpoints/posts/show.js | 6 +- src/api/endpoints/posts/timeline.js | 8 +- src/api/endpoints/username/available.js | 4 +- src/api/endpoints/users.js | 89 ++++++------ src/api/endpoints/users/followers.js | 6 +- src/api/endpoints/users/following.js | 6 +- src/api/endpoints/users/posts.js | 6 +- src/api/endpoints/users/recommendation.js | 6 +- src/api/endpoints/users/search.js | 6 +- src/api/endpoints/users/search_by_username.js | 6 +- src/api/endpoints/users/show.js | 6 +- src/api/event.ts | 6 +- src/api/serializers/app.ts | 12 +- src/api/serializers/auth-session.ts | 6 +- src/api/serializers/drive-file.ts | 24 ++-- src/api/serializers/drive-folder.ts | 12 +- src/api/serializers/drive-tag.ts | 10 +- src/api/serializers/messaging-message.ts | 10 +- src/api/serializers/notification.ts | 6 +- src/api/serializers/post.ts | 10 +- src/api/serializers/signin.ts | 6 +- src/api/serializers/user.ts | 8 +- src/web/app/common/scripts/api.js | 4 +- 81 files changed, 398 insertions(+), 397 deletions(-) diff --git a/src/api/endpoints/aggregation/posts/like.js b/src/api/endpoints/aggregation/posts/like.js index b5aa0a21a..02724aceb 100644 --- a/src/api/endpoints/aggregation/posts/like.js +++ b/src/api/endpoints/aggregation/posts/like.js @@ -10,8 +10,8 @@ import Like from '../../../models/like'; /** * Aggregate like of a post * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/posts/likes.js b/src/api/endpoints/aggregation/posts/likes.js index 2ea22516f..1049c7068 100644 --- a/src/api/endpoints/aggregation/posts/likes.js +++ b/src/api/endpoints/aggregation/posts/likes.js @@ -10,8 +10,8 @@ import Like from '../../../models/like'; /** * Aggregate likes of a post * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/posts/reply.js b/src/api/endpoints/aggregation/posts/reply.js index d79ccafb1..9d051c659 100644 --- a/src/api/endpoints/aggregation/posts/reply.js +++ b/src/api/endpoints/aggregation/posts/reply.js @@ -9,8 +9,8 @@ import Post from '../../../models/post'; /** * Aggregate reply of a post * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/posts/repost.js b/src/api/endpoints/aggregation/posts/repost.js index 3e4840510..01899ecea 100644 --- a/src/api/endpoints/aggregation/posts/repost.js +++ b/src/api/endpoints/aggregation/posts/repost.js @@ -9,8 +9,8 @@ import Post from '../../../models/post'; /** * Aggregate repost of a post * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/users/followers.js b/src/api/endpoints/aggregation/users/followers.js index 85cfe95da..3b8d1d604 100644 --- a/src/api/endpoints/aggregation/users/followers.js +++ b/src/api/endpoints/aggregation/users/followers.js @@ -10,8 +10,8 @@ import Following from '../../../models/following'; /** * Aggregate followers of a user * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/users/following.js b/src/api/endpoints/aggregation/users/following.js index 9647639fb..0b04ff954 100644 --- a/src/api/endpoints/aggregation/users/following.js +++ b/src/api/endpoints/aggregation/users/following.js @@ -10,8 +10,8 @@ import Following from '../../../models/following'; /** * Aggregate following of a user * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/users/like.js b/src/api/endpoints/aggregation/users/like.js index c138c6246..0b20dd09a 100644 --- a/src/api/endpoints/aggregation/users/like.js +++ b/src/api/endpoints/aggregation/users/like.js @@ -10,8 +10,8 @@ import Like from '../../../models/like'; /** * Aggregate like of a user * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/aggregation/users/post.js b/src/api/endpoints/aggregation/users/post.js index 3d1ea7d19..01082801e 100644 --- a/src/api/endpoints/aggregation/users/post.js +++ b/src/api/endpoints/aggregation/users/post.js @@ -10,8 +10,8 @@ import Post from '../../../models/post'; /** * Aggregate post of a user * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/app/create.js b/src/api/endpoints/app/create.js index 1febd9b56..9eb6863a8 100644 --- a/src/api/endpoints/app/create.js +++ b/src/api/endpoints/app/create.js @@ -47,13 +47,13 @@ import serialize from '../../serializers/app'; * in: formData * required: false * type: string - * + * * responses: * 200: * description: Created application's information * schema: * $ref: "#/definitions/Application" - * + * * default: * description: Failed * schema: @@ -63,9 +63,9 @@ import serialize from '../../serializers/app'; /** * Create an app * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = async (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/app/name_id/available.js b/src/api/endpoints/app/name_id/available.js index e101e0637..159d4fff4 100644 --- a/src/api/endpoints/app/name_id/available.js +++ b/src/api/endpoints/app/name_id/available.js @@ -17,7 +17,7 @@ import App from '../../../models/app'; * in: formData * required: true * type: string - * + * * responses: * 200: * description: Success @@ -27,7 +27,7 @@ import App from '../../../models/app'; * available: * description: Whether name_id is available * type: boolean - * + * * default: * description: Failed * schema: @@ -37,8 +37,8 @@ import App from '../../../models/app'; /** * Check available name_id of app * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = async (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/app/show.js b/src/api/endpoints/app/show.js index 2b651d53a..ab5f6f456 100644 --- a/src/api/endpoints/app/show.js +++ b/src/api/endpoints/app/show.js @@ -24,13 +24,13 @@ import serialize from '../../serializers/app'; * description: Application unique name * in: formData * type: string - * + * * responses: * 200: * description: Success * schema: * $ref: "#/definitions/Application" - * + * * default: * description: Failed * schema: @@ -40,11 +40,11 @@ import serialize from '../../serializers/app'; /** * Show an app * - * @param {Object} params - * @param {Object} user - * @param {Object} _ - * @param {Object} isSecure - * @return {Promise} + * @param {any} params + * @param {any} user + * @param {any} _ + * @param {any} isSecure + * @return {Promise} */ module.exports = (params, user, _, isSecure) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/auth/accept.js b/src/api/endpoints/auth/accept.js index 603f7d93a..1c0b10094 100644 --- a/src/api/endpoints/auth/accept.js +++ b/src/api/endpoints/auth/accept.js @@ -16,7 +16,7 @@ import AccessToken from '../../models/access-token'; * summary: Accept a session * parameters: * - $ref: "#/parameters/NativeToken" - * - + * - * name: token * description: Session Token * in: formData @@ -25,7 +25,7 @@ import AccessToken from '../../models/access-token'; * responses: * 204: * description: OK - * + * * default: * description: Failed * schema: @@ -35,9 +35,9 @@ import AccessToken from '../../models/access-token'; /** * Accept * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/auth/session/generate.js b/src/api/endpoints/auth/session/generate.js index f2b85a73a..cf75b83e2 100644 --- a/src/api/endpoints/auth/session/generate.js +++ b/src/api/endpoints/auth/session/generate.js @@ -20,7 +20,7 @@ import config from '../../../../conf'; * in: formData * required: true * type: string - * + * * responses: * 200: * description: OK @@ -42,8 +42,8 @@ import config from '../../../../conf'; /** * Generate a session * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/auth/session/show.js b/src/api/endpoints/auth/session/show.js index e161d9e57..425c980d9 100644 --- a/src/api/endpoints/auth/session/show.js +++ b/src/api/endpoints/auth/session/show.js @@ -18,11 +18,11 @@ import serialize from '../../../serializers/auth-session'; * in: formData * required: true * type: string - * + * * responses: * 200: * description: OK - * schema: + * schema: * type: object * properties: * created_at: @@ -49,9 +49,9 @@ import serialize from '../../../serializers/auth-session'; /** * Show a session * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/auth/session/userkey.js b/src/api/endpoints/auth/session/userkey.js index cf6a543cb..2c34304a5 100644 --- a/src/api/endpoints/auth/session/userkey.js +++ b/src/api/endpoints/auth/session/userkey.js @@ -47,8 +47,8 @@ import serialize from '../../../serializers/user'; /** * Generate a session * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/drive.js b/src/api/endpoints/drive.js index f0782d8ac..d73de67f4 100644 --- a/src/api/endpoints/drive.js +++ b/src/api/endpoints/drive.js @@ -8,30 +8,33 @@ import DriveFile from '../models/drive-file'; /** * Get drive information * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => - new Promise(async (res, rej) => -{ - // Calculate drive usage - const usage = ((await DriveFile - .aggregate([ - { $match: { user_id: user._id } }, - { $project: { - datasize: true - }}, - { $group: { - _id: null, - usage: { $sum: '$datasize' } - }} - ]))[0] || { - usage: 0 - }).usage; + new Promise(async (res, rej) => { + // Calculate drive usage + const usage = ((await DriveFile + .aggregate([ + { $match: { user_id: user._id } }, + { + $project: { + datasize: true + } + }, + { + $group: { + _id: null, + usage: { $sum: '$datasize' } + } + } + ]))[0] || { + usage: 0 + }).usage; - res({ - capacity: user.drive_capacity, - usage: usage + res({ + capacity: user.drive_capacity, + usage: usage + }); }); -}); diff --git a/src/api/endpoints/drive/files.js b/src/api/endpoints/drive/files.js index 7df8b81ea..cbfe72026 100644 --- a/src/api/endpoints/drive/files.js +++ b/src/api/endpoints/drive/files.js @@ -10,10 +10,10 @@ import serialize from '../../serializers/drive-file'; /** * Get drive files * - * @param {Object} params - * @param {Object} user - * @param {Object} app - * @return {Promise} + * @param {any} params + * @param {any} user + * @param {any} app + * @return {Promise} */ module.exports = (params, user, app) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/files/create.js b/src/api/endpoints/drive/files/create.js index a04cd5dde..9690b05cf 100644 --- a/src/api/endpoints/drive/files/create.js +++ b/src/api/endpoints/drive/files/create.js @@ -14,10 +14,10 @@ import create from '../../../common/add-file-to-drive'; /** * Create a file * - * @param {Object} file - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} file + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (file, params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/files/find.js b/src/api/endpoints/drive/files/find.js index 26c45c564..358767c5e 100644 --- a/src/api/endpoints/drive/files/find.js +++ b/src/api/endpoints/drive/files/find.js @@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-file'; /** * Find a file(s) * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/files/show.js b/src/api/endpoints/drive/files/show.js index 27062cb84..5ae98a4a7 100644 --- a/src/api/endpoints/drive/files/show.js +++ b/src/api/endpoints/drive/files/show.js @@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-file'; /** * Show a file * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/files/update.js b/src/api/endpoints/drive/files/update.js index 5af2b8e6d..8e2ff33e9 100644 --- a/src/api/endpoints/drive/files/update.js +++ b/src/api/endpoints/drive/files/update.js @@ -13,9 +13,9 @@ import event from '../../../event'; /** * Update a file * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/files/upload_from_url.js b/src/api/endpoints/drive/files/upload_from_url.js index 906c3a7a9..3619a6f10 100644 --- a/src/api/endpoints/drive/files/upload_from_url.js +++ b/src/api/endpoints/drive/files/upload_from_url.js @@ -15,9 +15,9 @@ import create from '../../../common/add-file-to-drive'; /** * Create a file from a URL * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/folders.js b/src/api/endpoints/drive/folders.js index 672ae2178..631d68769 100644 --- a/src/api/endpoints/drive/folders.js +++ b/src/api/endpoints/drive/folders.js @@ -10,10 +10,10 @@ import serialize from '../../serializers/drive-folder'; /** * Get drive folders * - * @param {Object} params - * @param {Object} user - * @param {Object} app - * @return {Promise} + * @param {any} params + * @param {any} user + * @param {any} app + * @return {Promise} */ module.exports = (params, user, app) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/folders/create.js b/src/api/endpoints/drive/folders/create.js index a9c0968aa..9ba989c21 100644 --- a/src/api/endpoints/drive/folders/create.js +++ b/src/api/endpoints/drive/folders/create.js @@ -12,9 +12,9 @@ import event from '../../../event'; /** * Create drive folder * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/folders/find.js b/src/api/endpoints/drive/folders/find.js index be05427f5..802d3a790 100644 --- a/src/api/endpoints/drive/folders/find.js +++ b/src/api/endpoints/drive/folders/find.js @@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-folder'; /** * Find a folder(s) * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/folders/show.js b/src/api/endpoints/drive/folders/show.js index 04b924dc5..986d32cf6 100644 --- a/src/api/endpoints/drive/folders/show.js +++ b/src/api/endpoints/drive/folders/show.js @@ -10,9 +10,9 @@ import serialize from '../../../serializers/drive-folder'; /** * Show a folder * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/folders/update.js b/src/api/endpoints/drive/folders/update.js index 542c94d9d..713e17b43 100644 --- a/src/api/endpoints/drive/folders/update.js +++ b/src/api/endpoints/drive/folders/update.js @@ -12,9 +12,9 @@ import event from '../../../event'; /** * Update a folder * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/drive/stream.js b/src/api/endpoints/drive/stream.js index 0534b884c..cd39261de 100644 --- a/src/api/endpoints/drive/stream.js +++ b/src/api/endpoints/drive/stream.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/drive-file'; /** * Get drive stream * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/following/create.js b/src/api/endpoints/following/create.js index 953fd780d..46ff77ddf 100644 --- a/src/api/endpoints/following/create.js +++ b/src/api/endpoints/following/create.js @@ -13,9 +13,9 @@ import serializeUser from '../../serializers/user'; /** * Follow a user * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/following/delete.js b/src/api/endpoints/following/delete.js index dced63591..1085013d0 100644 --- a/src/api/endpoints/following/delete.js +++ b/src/api/endpoints/following/delete.js @@ -12,9 +12,9 @@ import serializeUser from '../../serializers/user'; /** * Unfollow a user * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i.js b/src/api/endpoints/i.js index 481ddbb9f..df8c0d0e0 100644 --- a/src/api/endpoints/i.js +++ b/src/api/endpoints/i.js @@ -8,11 +8,11 @@ import serialize from '../serializers/user'; /** * Show myself * - * @param {Object} params - * @param {Object} user - * @param {Object} app + * @param {any} params + * @param {any} user + * @param {any} app * @param {Boolean} isSecure - * @return {Promise} + * @return {Promise} */ module.exports = (params, user, _, isSecure) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/appdata/get.js b/src/api/endpoints/i/appdata/get.js index 0a8669746..7f1bdf071 100644 --- a/src/api/endpoints/i/appdata/get.js +++ b/src/api/endpoints/i/appdata/get.js @@ -8,11 +8,11 @@ import Appdata from '../../../models/appdata'; /** * Get app data * - * @param {Object} params - * @param {Object} user - * @param {Object} app + * @param {any} params + * @param {any} user + * @param {any} app * @param {Boolean} isSecure - * @return {Promise} + * @return {Promise} */ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/appdata/set.js b/src/api/endpoints/i/appdata/set.js index 947ba0cb4..57001f4e8 100644 --- a/src/api/endpoints/i/appdata/set.js +++ b/src/api/endpoints/i/appdata/set.js @@ -11,11 +11,11 @@ import event from '../../../event'; /** * Set app data * - * @param {Object} params - * @param {Object} user - * @param {Object} app + * @param {any} params + * @param {any} user + * @param {any} app * @param {Boolean} isSecure - * @return {Promise} + * @return {Promise} */ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/authorized_apps.js b/src/api/endpoints/i/authorized_apps.js index 12d4ca8e8..3c0cf7505 100644 --- a/src/api/endpoints/i/authorized_apps.js +++ b/src/api/endpoints/i/authorized_apps.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/app'; /** * Get authorized apps of my account * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/favorites.js b/src/api/endpoints/i/favorites.js index d943bec32..28e402e36 100644 --- a/src/api/endpoints/i/favorites.js +++ b/src/api/endpoints/i/favorites.js @@ -10,8 +10,8 @@ import serialize from '../../serializers/post'; /** * Get followers of a user * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/notifications.js b/src/api/endpoints/i/notifications.js index c91f3468e..d5174439e 100644 --- a/src/api/endpoints/i/notifications.js +++ b/src/api/endpoints/i/notifications.js @@ -11,9 +11,9 @@ import getFriends from '../../common/get-friends'; /** * Get notifications * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/signin_history.js b/src/api/endpoints/i/signin_history.js index c373e7b7a..ede821e3c 100644 --- a/src/api/endpoints/i/signin_history.js +++ b/src/api/endpoints/i/signin_history.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/signin'; /** * Get signin history of my account * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/i/update.js b/src/api/endpoints/i/update.js index cd8f9b49d..fdb89644a 100644 --- a/src/api/endpoints/i/update.js +++ b/src/api/endpoints/i/update.js @@ -13,11 +13,11 @@ import config from '../../../conf'; /** * Update myself * - * @param {Object} params - * @param {Object} user - * @param {Object} _ + * @param {any} params + * @param {any} user + * @param {any} _ * @param {boolean} isSecure - * @return {Promise} + * @return {Promise} */ module.exports = async (params, user, _, isSecure) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/messaging/history.js b/src/api/endpoints/messaging/history.js index e6e6ac87b..60c34a6a4 100644 --- a/src/api/endpoints/messaging/history.js +++ b/src/api/endpoints/messaging/history.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/messaging-message'; /** * Show messaging history * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/messaging/messages.js b/src/api/endpoints/messaging/messages.js index 674b25056..eaaf38c39 100644 --- a/src/api/endpoints/messaging/messages.js +++ b/src/api/endpoints/messaging/messages.js @@ -13,9 +13,9 @@ import { publishMessagingStream } from '../../event'; /** * Get messages * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/messaging/messages/create.js b/src/api/endpoints/messaging/messages/create.js index 69f9811b8..a88cc39ee 100644 --- a/src/api/endpoints/messaging/messages/create.js +++ b/src/api/endpoints/messaging/messages/create.js @@ -21,9 +21,9 @@ const maxTextLength = 500; /** * Create a message * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/messaging/unread.js b/src/api/endpoints/messaging/unread.js index d2de0bc44..faba171bd 100644 --- a/src/api/endpoints/messaging/unread.js +++ b/src/api/endpoints/messaging/unread.js @@ -8,9 +8,9 @@ import Message from '../../models/messaging-message'; /** * Get count of unread messages * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/meta.js b/src/api/endpoints/meta.js index a480be63e..421ec01d0 100644 --- a/src/api/endpoints/meta.js +++ b/src/api/endpoints/meta.js @@ -36,8 +36,8 @@ import git from 'git-last-commit'; /** * Show core info * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/my/apps.js b/src/api/endpoints/my/apps.js index 818c63694..1f45a1a27 100644 --- a/src/api/endpoints/my/apps.js +++ b/src/api/endpoints/my/apps.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/app'; /** * Get my apps * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/notifications/mark_as_read.js b/src/api/endpoints/notifications/mark_as_read.js index 9cab3edb2..9c8a5ee64 100644 --- a/src/api/endpoints/notifications/mark_as_read.js +++ b/src/api/endpoints/notifications/mark_as_read.js @@ -11,9 +11,9 @@ import event from '../../../event'; /** * Mark as read a notification * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts.js b/src/api/endpoints/posts.js index 59cfb8a44..42294a39c 100644 --- a/src/api/endpoints/posts.js +++ b/src/api/endpoints/posts.js @@ -9,80 +9,79 @@ import serialize from '../serializers/post'; /** * Lists all posts * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = (params) => - new Promise(async (res, rej) => -{ - // Get 'include_replies' parameter - let includeReplies = params.include_replies; - if (includeReplies === true) { - includeReplies = true; - } else { - includeReplies = false; - } - - // Get 'include_reposts' parameter - let includeReposts = params.include_reposts; - if (includeReposts === true) { - includeReposts = true; - } else { - includeReposts = false; - } - - // Get 'limit' parameter - let limit = params.limit; - if (limit !== undefined && limit !== null) { - limit = parseInt(limit, 10); - - // From 1 to 100 - if (!(1 <= limit && limit <= 100)) { - return rej('invalid limit range'); + new Promise(async (res, rej) => { + // Get 'include_replies' parameter + let includeReplies = params.include_replies; + if (includeReplies === true) { + includeReplies = true; + } else { + includeReplies = false; } - } else { - limit = 10; - } - const since = params.since_id || null; - const max = params.max_id || null; + // Get 'include_reposts' parameter + let includeReposts = params.include_reposts; + if (includeReposts === true) { + includeReposts = true; + } else { + includeReposts = false; + } - // Check if both of since_id and max_id is specified - if (since !== null && max !== null) { - return rej('cannot set since_id and max_id'); - } + // Get 'limit' parameter + let limit = params.limit; + if (limit !== undefined && limit !== null) { + limit = parseInt(limit, 10); - // Construct query - const sort = { - _id: -1 - }; - const query = {}; - if (since !== null) { - sort._id = 1; - query._id = { - $gt: new mongo.ObjectID(since) + // From 1 to 100 + if (!(1 <= limit && limit <= 100)) { + return rej('invalid limit range'); + } + } else { + limit = 10; + } + + const since = params.since_id || null; + const max = params.max_id || null; + + // Check if both of since_id and max_id is specified + if (since !== null && max !== null) { + return rej('cannot set since_id and max_id'); + } + + // Construct query + const sort = { + _id: -1 }; - } else if (max !== null) { - query._id = { - $lt: new mongo.ObjectID(max) - }; - } + const query = {}; + if (since !== null) { + sort._id = 1; + query._id = { + $gt: new mongo.ObjectID(since) + }; + } else if (max !== null) { + query._id = { + $lt: new mongo.ObjectID(max) + }; + } - if (!includeReplies) { - query.reply_to_id = null; - } + if (!includeReplies) { + query.reply_to_id = null; + } - if (!includeReposts) { - query.repost_id = null; - } + if (!includeReposts) { + query.repost_id = null; + } - // Issue query - const posts = await Post - .find(query, { - limit: limit, - sort: sort - }); + // Issue query + const posts = await Post + .find(query, { + limit: limit, + sort: sort + }); - // Serialize - res(await Promise.all(posts.map(async post => await serialize(post)))); -}); + // Serialize + res(await Promise.all(posts.map(async post => await serialize(post)))); + }); diff --git a/src/api/endpoints/posts/context.js b/src/api/endpoints/posts/context.js index 5f040b850..b84304464 100644 --- a/src/api/endpoints/posts/context.js +++ b/src/api/endpoints/posts/context.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/post'; /** * Show a context of a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/create.js b/src/api/endpoints/posts/create.js index 0296c0e60..57e95bd71 100644 --- a/src/api/endpoints/posts/create.js +++ b/src/api/endpoints/posts/create.js @@ -28,10 +28,10 @@ const maxMediaCount = 4; /** * Create a post * - * @param {Object} params - * @param {Object} user - * @param {Object} app - * @return {Promise} + * @param {any} params + * @param {any} user + * @param {any} app + * @return {Promise} */ module.exports = (params, user, app) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/favorites/create.js b/src/api/endpoints/posts/favorites/create.js index 0d9e86a9f..7ee7c0d3f 100644 --- a/src/api/endpoints/posts/favorites/create.js +++ b/src/api/endpoints/posts/favorites/create.js @@ -10,9 +10,9 @@ import Post from '../../models/post'; /** * Favorite a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts/favorites/delete.js b/src/api/endpoints/posts/favorites/delete.js index e13f78654..4b36b9bde 100644 --- a/src/api/endpoints/posts/favorites/delete.js +++ b/src/api/endpoints/posts/favorites/delete.js @@ -10,9 +10,9 @@ import Post from '../../models/post'; /** * Unfavorite a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts/likes.js b/src/api/endpoints/posts/likes.js index 6d3ab866b..67898218c 100644 --- a/src/api/endpoints/posts/likes.js +++ b/src/api/endpoints/posts/likes.js @@ -11,9 +11,9 @@ import serialize from '../../serializers/user'; /** * Show a likes of a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/likes/create.js b/src/api/endpoints/posts/likes/create.js index 6b8f1addd..3b2c778a0 100644 --- a/src/api/endpoints/posts/likes/create.js +++ b/src/api/endpoints/posts/likes/create.js @@ -12,9 +12,9 @@ import notify from '../../../common/notify'; /** * Like a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts/likes/delete.js b/src/api/endpoints/posts/likes/delete.js index a863fb267..1dd0f5b29 100644 --- a/src/api/endpoints/posts/likes/delete.js +++ b/src/api/endpoints/posts/likes/delete.js @@ -12,9 +12,9 @@ import User from '../../../models/user'; /** * Unlike a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts/mentions.js b/src/api/endpoints/posts/mentions.js index 7377e3523..5a3d72aab 100644 --- a/src/api/endpoints/posts/mentions.js +++ b/src/api/endpoints/posts/mentions.js @@ -11,9 +11,9 @@ import serialize from '../../serializers/post'; /** * Get mentions of myself * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/polls/vote.js b/src/api/endpoints/posts/polls/vote.js index bb4f7b259..9f9a5171a 100644 --- a/src/api/endpoints/posts/polls/vote.js +++ b/src/api/endpoints/posts/polls/vote.js @@ -11,9 +11,9 @@ import notify from '../../../common/notify'; /** * Vote poll of a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { diff --git a/src/api/endpoints/posts/replies.js b/src/api/endpoints/posts/replies.js index 5ce1133e0..cbbb5dc31 100644 --- a/src/api/endpoints/posts/replies.js +++ b/src/api/endpoints/posts/replies.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/post'; /** * Show a replies of a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/reposts.js b/src/api/endpoints/posts/reposts.js index ed97a601e..0ffe44cb1 100644 --- a/src/api/endpoints/posts/reposts.js +++ b/src/api/endpoints/posts/reposts.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/post'; /** * Show a reposts of a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/search.js b/src/api/endpoints/posts/search.js index 2ee00b899..bc06340fd 100644 --- a/src/api/endpoints/posts/search.js +++ b/src/api/endpoints/posts/search.js @@ -12,9 +12,9 @@ import config from '../../../conf'; /** * Search a post * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/show.js b/src/api/endpoints/posts/show.js index 1b9a747a8..4938199cd 100644 --- a/src/api/endpoints/posts/show.js +++ b/src/api/endpoints/posts/show.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/post'; /** * Show a post * - * @param {Object} params - * @param {Object} user - * @return {Promise} + * @param {any} params + * @param {any} user + * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/posts/timeline.js b/src/api/endpoints/posts/timeline.js index 626f828ef..48f7c2694 100644 --- a/src/api/endpoints/posts/timeline.js +++ b/src/api/endpoints/posts/timeline.js @@ -11,10 +11,10 @@ import serialize from '../../serializers/post'; /** * Get timeline of myself * - * @param {Object} params - * @param {Object} user - * @param {Object} app - * @return {Promise} + * @param {any} params + * @param {any} user + * @param {any} app + * @return {Promise} */ module.exports = (params, user, app) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/username/available.js b/src/api/endpoints/username/available.js index a93637bc1..8f4d8cf28 100644 --- a/src/api/endpoints/username/available.js +++ b/src/api/endpoints/username/available.js @@ -9,8 +9,8 @@ import { validateUsername } from '../../models/user'; /** * Check available username * - * @param {Object} params - * @return {Promise} + * @param {any} params + * @return {Promise} */ module.exports = async (params) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users.js b/src/api/endpoints/users.js index 671eaae14..63e28caa4 100644 --- a/src/api/endpoints/users.js +++ b/src/api/endpoints/users.js @@ -9,58 +9,57 @@ import serialize from '../serializers/user'; /** * Lists all users * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => - new Promise(async (res, rej) => -{ - // Get 'limit' parameter - let limit = params.limit; - if (limit !== undefined && limit !== null) { - limit = parseInt(limit, 10); + new Promise(async (res, rej) => { + // Get 'limit' parameter + let limit = params.limit; + if (limit !== undefined && limit !== null) { + limit = parseInt(limit, 10); - // From 1 to 100 - if (!(1 <= limit && limit <= 100)) { - return rej('invalid limit range'); + // From 1 to 100 + if (!(1 <= limit && limit <= 100)) { + return rej('invalid limit range'); + } + } else { + limit = 10; } - } else { - limit = 10; - } - const since = params.since_id || null; - const max = params.max_id || null; + const since = params.since_id || null; + const max = params.max_id || null; - // Check if both of since_id and max_id is specified - if (since !== null && max !== null) { - return rej('cannot set since_id and max_id'); - } + // Check if both of since_id and max_id is specified + if (since !== null && max !== null) { + return rej('cannot set since_id and max_id'); + } - // Construct query - const sort = { - _id: -1 - }; - const query = {}; - if (since !== null) { - sort._id = 1; - query._id = { - $gt: new mongo.ObjectID(since) + // Construct query + const sort = { + _id: -1 }; - } else if (max !== null) { - query._id = { - $lt: new mongo.ObjectID(max) - }; - } + const query = {}; + if (since !== null) { + sort._id = 1; + query._id = { + $gt: new mongo.ObjectID(since) + }; + } else if (max !== null) { + query._id = { + $lt: new mongo.ObjectID(max) + }; + } - // Issue query - const users = await User - .find(query, { - limit: limit, - sort: sort - }); + // Issue query + const users = await User + .find(query, { + limit: limit, + sort: sort + }); - // Serialize - res(await Promise.all(users.map(async user => - await serialize(user, me)))); -}); + // Serialize + res(await Promise.all(users.map(async user => + await serialize(user, me)))); + }); diff --git a/src/api/endpoints/users/followers.js b/src/api/endpoints/users/followers.js index 5e11613c5..598c3b6bc 100644 --- a/src/api/endpoints/users/followers.js +++ b/src/api/endpoints/users/followers.js @@ -12,9 +12,9 @@ import getFriends from '../../common/get-friends'; /** * Get followers of a user * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/following.js b/src/api/endpoints/users/following.js index 7b81cc4f3..36868d6d5 100644 --- a/src/api/endpoints/users/following.js +++ b/src/api/endpoints/users/following.js @@ -12,9 +12,9 @@ import getFriends from '../../common/get-friends'; /** * Get following users of a user * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/posts.js b/src/api/endpoints/users/posts.js index 30d3a556a..d358c4b4d 100644 --- a/src/api/endpoints/users/posts.js +++ b/src/api/endpoints/users/posts.js @@ -11,9 +11,9 @@ import serialize from '../../serializers/post'; /** * Get posts of a user * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/recommendation.js b/src/api/endpoints/users/recommendation.js index d4c33c37a..0045683a5 100644 --- a/src/api/endpoints/users/recommendation.js +++ b/src/api/endpoints/users/recommendation.js @@ -10,9 +10,9 @@ import getFriends from '../../common/get-friends'; /** * Get recommended users * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/search.js b/src/api/endpoints/users/search.js index 8205de580..b1f453732 100644 --- a/src/api/endpoints/users/search.js +++ b/src/api/endpoints/users/search.js @@ -12,9 +12,9 @@ const escapeRegexp = require('escape-regexp'); /** * Search a user * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/search_by_username.js b/src/api/endpoints/users/search_by_username.js index 2f19df3c8..7fe6f3409 100644 --- a/src/api/endpoints/users/search_by_username.js +++ b/src/api/endpoints/users/search_by_username.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/user'; /** * Search a user by username * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/endpoints/users/show.js b/src/api/endpoints/users/show.js index bc7e3a9d5..0eaba221c 100644 --- a/src/api/endpoints/users/show.js +++ b/src/api/endpoints/users/show.js @@ -10,9 +10,9 @@ import serialize from '../../serializers/user'; /** * Show a user * - * @param {Object} params - * @param {Object} me - * @return {Promise} + * @param {any} params + * @param {any} me + * @return {Promise} */ module.exports = (params, me) => new Promise(async (res, rej) => diff --git a/src/api/event.ts b/src/api/event.ts index 58b3260d5..24541ee26 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -13,7 +13,7 @@ class MisskeyEvent { 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 ? { type: type } : { type: type, body: value }; @@ -21,11 +21,11 @@ class MisskeyEvent { 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); } - 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); } } diff --git a/src/api/serializers/app.ts b/src/api/serializers/app.ts index bb599dc46..9a02c5637 100644 --- a/src/api/serializers/app.ts +++ b/src/api/serializers/app.ts @@ -12,10 +12,10 @@ import config from '../../conf'; /** * Serialize an app * - * @param {Object} app - * @param {Object} me? - * @param {Object} options? - * @return {Promise} + * @param {any} app + * @param {any} me? + * @param {any} options? + * @return {Promise} */ export default ( app: any, @@ -75,8 +75,8 @@ export default ( app_id: _app.id, user_id: me, }, { - limit: 1 - }); + limit: 1 + }); _app.is_authorized = exist === 1; } diff --git a/src/api/serializers/auth-session.ts b/src/api/serializers/auth-session.ts index b2dc93d3f..4efb7729c 100644 --- a/src/api/serializers/auth-session.ts +++ b/src/api/serializers/auth-session.ts @@ -10,9 +10,9 @@ import serializeApp from './app'; /** * Serialize an auth session * - * @param {Object} session - * @param {Object} me? - * @return {Promise} + * @param {any} session + * @param {any} me? + * @return {Promise} */ export default ( session: any, diff --git a/src/api/serializers/drive-file.ts b/src/api/serializers/drive-file.ts index 02241c226..e6e2f6cae 100644 --- a/src/api/serializers/drive-file.ts +++ b/src/api/serializers/drive-file.ts @@ -13,16 +13,16 @@ import config from '../../conf'; /** * Serialize a drive file * - * @param {Object} file - * @param {Object} options? - * @return {Promise} + * @param {any} file + * @param {any} options? + * @return {Promise} */ export default ( file: any, options?: { detail: boolean } -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { const opts = Object.assign({ detail: false }, options); @@ -34,18 +34,18 @@ export default ( _file = await DriveFile.findOne({ _id: file }, { - fields: { - data: false - } - }); + fields: { + data: false + } + }); } else if (typeof file === 'string') { _file = await DriveFile.findOne({ _id: new mongo.ObjectID(file) }, { - fields: { - data: false - } - }); + fields: { + data: false + } + }); } else { _file = deepcopy(file); } diff --git a/src/api/serializers/drive-folder.ts b/src/api/serializers/drive-folder.ts index a5339ce96..ac3bd13c3 100644 --- a/src/api/serializers/drive-folder.ts +++ b/src/api/serializers/drive-folder.ts @@ -10,16 +10,16 @@ import deepcopy = require('deepcopy'); /** * Serialize a drive folder * - * @param {Object} folder - * @param {Object} options? - * @return {Promise} + * @param {any} folder + * @param {any} options? + * @return {Promise} */ const self = ( folder: any, options?: { detail: boolean } -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { const opts = Object.assign({ detail: false }, options); @@ -28,9 +28,9 @@ const self = ( // Populate the folder if 'folder' is ID if (mongo.ObjectID.prototype.isPrototypeOf(folder)) { - _folder = await DriveFolder.findOne({_id: folder}); + _folder = await DriveFolder.findOne({ _id: folder }); } else if (typeof folder === 'string') { - _folder = await DriveFolder.findOne({_id: new mongo.ObjectID(folder)}); + _folder = await DriveFolder.findOne({ _id: new mongo.ObjectID(folder) }); } else { _folder = deepcopy(folder); } diff --git a/src/api/serializers/drive-tag.ts b/src/api/serializers/drive-tag.ts index 603b1d7d3..3e800ca5b 100644 --- a/src/api/serializers/drive-tag.ts +++ b/src/api/serializers/drive-tag.ts @@ -10,19 +10,19 @@ import deepcopy = require('deepcopy'); /** * Serialize a drive tag * - * @param {Object} tag - * @return {Promise} + * @param {any} tag + * @return {Promise} */ const self = ( tag: any -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { let _tag: any; // Populate the tag if 'tag' is ID if (mongo.ObjectID.prototype.isPrototypeOf(tag)) { - _tag = await DriveTag.findOne({_id: tag}); + _tag = await DriveTag.findOne({ _id: tag }); } else if (typeof tag === 'string') { - _tag = await DriveTag.findOne({_id: new mongo.ObjectID(tag)}); + _tag = await DriveTag.findOne({ _id: new mongo.ObjectID(tag) }); } else { _tag = deepcopy(tag); } diff --git a/src/api/serializers/messaging-message.ts b/src/api/serializers/messaging-message.ts index c25b9968a..4a4c8fc5b 100644 --- a/src/api/serializers/messaging-message.ts +++ b/src/api/serializers/messaging-message.ts @@ -12,10 +12,10 @@ import deepcopy = require('deepcopy'); /** * Serialize a message * - * @param {Object} message - * @param {Object} me? - * @param {Object} options? - * @return {Promise} + * @param {any} message + * @param {any} me? + * @param {any} options? + * @return {Promise} */ export default ( message: any, @@ -23,7 +23,7 @@ export default ( options?: { populateRecipient: boolean } -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { const opts = options || { populateRecipient: true }; diff --git a/src/api/serializers/notification.ts b/src/api/serializers/notification.ts index df86218aa..43add127e 100644 --- a/src/api/serializers/notification.ts +++ b/src/api/serializers/notification.ts @@ -12,10 +12,10 @@ import deepcopy = require('deepcopy'); /** * Serialize a notification * - * @param {Object} notification - * @return {Promise} + * @param {any} notification + * @return {Promise} */ -export default (notification: any) => new Promise(async (resolve, reject) => { +export default (notification: any) => new Promise(async (resolve, reject) => { let _notification: any; // Populate the notification if 'notification' is ID diff --git a/src/api/serializers/post.ts b/src/api/serializers/post.ts index 575cfc239..b71b42e9a 100644 --- a/src/api/serializers/post.ts +++ b/src/api/serializers/post.ts @@ -15,10 +15,10 @@ import deepcopy = require('deepcopy'); /** * Serialize a post * - * @param {Object} post - * @param {Object} me? - * @param {Object} options? - * @return {Promise} + * @param {any} post + * @param {any} me? + * @param {any} options? + * @return {Promise} */ const self = ( post: any, @@ -26,7 +26,7 @@ const self = ( options?: { detail: boolean } -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { const opts = options || { detail: true, }; diff --git a/src/api/serializers/signin.ts b/src/api/serializers/signin.ts index 828a16538..39226f8bd 100644 --- a/src/api/serializers/signin.ts +++ b/src/api/serializers/signin.ts @@ -8,12 +8,12 @@ import deepcopy = require('deepcopy'); /** * Serialize a signin record * - * @param {Object} record - * @return {Promise} + * @param {any} record + * @return {Promise} */ export default ( record: any -) => new Promise(async (resolve, reject) => { +) => new Promise(async (resolve, reject) => { const _record = deepcopy(record); diff --git a/src/api/serializers/user.ts b/src/api/serializers/user.ts index 09dc3e87d..de215808a 100644 --- a/src/api/serializers/user.ts +++ b/src/api/serializers/user.ts @@ -13,10 +13,10 @@ import config from '../../conf'; /** * Serialize a user * - * @param {Object} user - * @param {Object} me? - * @param {Object} options? - * @return {Promise} + * @param {any} user + * @param {any} me? + * @param {any} options? + * @return {Promise} */ export default ( user: any, diff --git a/src/web/app/common/scripts/api.js b/src/web/app/common/scripts/api.js index be72f863d..3df54b645 100644 --- a/src/web/app/common/scripts/api.js +++ b/src/web/app/common/scripts/api.js @@ -11,8 +11,8 @@ let pending = 0; * Send a request to API * @param {string|Object} i Credential * @param {string} endpoint Endpoint - * @param {Object} [data={}] Data - * @return {Promise} Response + * @param {any} [data={}] Data + * @return {Promise} Response */ module.exports = (i, endpoint, data = {}) => { if (++pending === 1) {