Resolver cleanup

This commit is contained in:
Wyatt Johnson
2017-05-16 17:26:34 -06:00
parent f4b9191476
commit fde4dee52f
2 changed files with 23 additions and 20 deletions
+9 -1
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, sort}) => {
const getUsersByQuery = ({user}, {ids, limit, cursor, statuses = null, sort}) => {
let users = UserModel.find();
@@ -27,6 +27,14 @@ const getUsersByQuery = ({user}, {ids, limit, cursor, sort}) => {
});
}
if (statuses != null) {
users = users.where({
status: {
$in: statuses
}
});
}
if (cursor) {
if (sort === 'REVERSE_CHRONOLOGICAL') {
users = users.where({