diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-28 16:39:14 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-28 16:39:14 +0900 |
| commit | 3d5cdb8d2d60932caf1d29b0581c7d6243e06e37 (patch) | |
| tree | 9c29d1062b08378d4c4cafe5976793616d45bc01 /src/api/endpoints/users/posts.ts | |
| parent | wip (diff) | |
| download | sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.gz sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.bz2 sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.zip | |
wip
Diffstat (limited to 'src/api/endpoints/users/posts.ts')
| -rw-r--r-- | src/api/endpoints/users/posts.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts index 3c84bf0d80..f08be91c4d 100644 --- a/src/api/endpoints/users/posts.ts +++ b/src/api/endpoints/users/posts.ts @@ -14,16 +14,16 @@ import User from '../../models/user'; * @return {Promise<any>} */ module.exports = (params, me) => new Promise(async (res, rej) => { - // Get 'user_id' parameter - const [userId, userIdErr] = $(params.user_id).optional.id().$; - if (userIdErr) return rej('invalid user_id param'); + // Get 'userId' parameter + const [userId, userIdErr] = $(params.userId).optional.id().$; + if (userIdErr) return rej('invalid userId param'); // Get 'username' parameter const [username, usernameErr] = $(params.username).optional.string().$; if (usernameErr) return rej('invalid username param'); if (userId === undefined && username === undefined) { - return rej('user_id or pair of username and host is required'); + return rej('userId or pair of username and host is required'); } // Get 'host' parameter @@ -31,7 +31,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { if (hostErr) return rej('invalid host param'); if (userId === undefined && host === undefined) { - return rej('user_id or pair of username and host is required'); + return rej('userId or pair of username and host is required'); } // Get 'include_replies' parameter @@ -69,7 +69,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const q = userId !== undefined ? { _id: userId } - : { username_lower: username.toLowerCase(), host_lower: getHostLower(host) } ; + : { usernameLower: username.toLowerCase(), hostLower: getHostLower(host) } ; // Lookup user const user = await User.findOne(q, { @@ -88,7 +88,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { }; const query = { - user_id: user._id + userId: user._id } as any; if (sinceId) { @@ -102,21 +102,21 @@ module.exports = (params, me) => new Promise(async (res, rej) => { }; } else if (sinceDate) { sort._id = 1; - query.created_at = { + query.createdAt = { $gt: new Date(sinceDate) }; } else if (untilDate) { - query.created_at = { + query.createdAt = { $lt: new Date(untilDate) }; } if (!includeReplies) { - query.reply_id = null; + query.replyId = null; } if (withMedia) { - query.media_ids = { + query.mediaIds = { $exists: true, $ne: null }; |