From 9d3dff88056dac8eb00e62fedf438b197f99c256 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 3 Mar 2017 06:29:49 +0900 Subject: [PATCH] wip --- src/api/endpoints/posts/likes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/endpoints/posts/likes.ts b/src/api/endpoints/posts/likes.ts index 5c18679d7c..e44013c246 100644 --- a/src/api/endpoints/posts/likes.ts +++ b/src/api/endpoints/posts/likes.ts @@ -31,12 +31,12 @@ module.exports = (params, user) => if (offsetErr) return rej('invalid offset'); // Get 'sort' parameter - const [sort] = it(params.sort).expect.string().or('desc asc').default('desc').qed(); - let sort = params.sort || 'desc'; + const [sort, sortError] = it(params.sort).expect.string().or('desc asc').default('desc').qed(); + if (sortError) return rej('invalid sort'); // Lookup post const post = await Post.findOne({ - _id: new mongo.ObjectID(postId) + _id: postId }); if (post === null) {