Adding statuses

This commit is contained in:
Belen Curcio
2017-09-19 13:10:35 -03:00
parent b3cb99925d
commit bccad5585e
2 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -115,7 +115,7 @@ const getUsersByQuery = async ({user, loaders: {Actions}}, {ids, limit, cursor,
* @return {Promise} resolves to the counts of the users from the
* query
*/
const getCountByQuery = async ({loaders: {Actions}}, {action_type}) => {
const getCountByQuery = async ({loaders: {Actions}}, {action_type, statuses}) => {
let query = UserModel.find();
if (action_type) {
@@ -128,6 +128,14 @@ const getCountByQuery = async ({loaders: {Actions}}, {action_type}) => {
});
}
if (statuses) {
query = query.where({
status: {
$in: statuses
}
});
}
return UserModel
.find(query)
.count();
+3
View File
@@ -348,6 +348,9 @@ input UserCountQuery {
# comments returned will only be ones which have at least one action of this
# type.
action_type: ACTION_TYPE
# Current status of a user.
statuses: [USER_STATUS]
}
type EditInfo {