changed sort -> sortOrder

This commit is contained in:
Wyatt Johnson
2017-08-25 09:59:37 -06:00
parent 48595a1bbf
commit 8a5db167ff
14 changed files with 75 additions and 79 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ const genUserByIDs = (context, ids) => UsersService
* @param {Object} context graph context
* @param {Object} query query terms to apply to the users query
*/
const getUsersByQuery = ({user}, {ids, limit, cursor, statuses = null, sort}) => {
const getUsersByQuery = ({user}, {ids, limit, cursor, statuses = null, sortOrder}) => {
let users = UserModel.find();
@@ -36,7 +36,7 @@ const getUsersByQuery = ({user}, {ids, limit, cursor, statuses = null, sort}) =>
}
if (cursor) {
if (sort === 'DESC') {
if (sortOrder === 'DESC') {
users = users.where({
created_at: {
$lt: cursor
@@ -52,7 +52,7 @@ const getUsersByQuery = ({user}, {ids, limit, cursor, statuses = null, sort}) =>
}
return users
.sort({created_at: sort === 'DESC' ? -1 : 1})
.sort({created_at: sortOrder === 'DESC' ? -1 : 1})
.limit(limit);
};