diff --git a/client/src/components/UserSearch.js b/client/src/components/UserSearch.js index 688bef074..8284b68f6 100644 --- a/client/src/components/UserSearch.js +++ b/client/src/components/UserSearch.js @@ -156,6 +156,7 @@ class UserSearch extends Component { if (data.loading) { return (
Loading Users...
) } else { + console.log(data) if (data.usersSearch === undefined) { return (
No Users to Display
) } else { diff --git a/server/schema/schema.js b/server/schema/schema.js index e2d93a6bc..09264ccf2 100644 --- a/server/schema/schema.js +++ b/server/schema/schema.js @@ -153,6 +153,8 @@ const RootQuery = new GraphQLObjectType({ type: new GraphQLList(UserType), args: {alias: {type: GraphQLString}, firstName: {type: GraphQLString}, middleName: {type: GraphQLString}, lastName: {type: GraphQLString}}, resolve (parent, args) { + if (INFO_LOG === true) { console.log('[INFO] ' + MODULE_NAME + ' -> RootQuery -> usersSearch -> resolve -> Entering function.') } + let mongoQuery = { $or: [] } if (args.alias !== null && args.alias !== '') { mongoQuery.$or.push({alias: args.alias}) } @@ -161,14 +163,16 @@ const RootQuery = new GraphQLObjectType({ if (args.lastName !== null && args.lastName !== '') { mongoQuery.$or.push({lastName: args.lastName}) } if (mongoQuery.$or.length === 0) { mongoQuery = {} } - - return User.find([mongoQuery]) + console.log('mongoQuery', mongoQuery) + return User.find(mongoQuery) } }, descendents: { type: new GraphQLList(DescendentType), args: {id: {type: GraphQLString}}, resolve (parent, args) { + if (INFO_LOG === true) { console.log('[INFO] ' + MODULE_NAME + ' -> RootQuery -> descendents -> resolve -> Entering function.') } + return User.find({referrerId: args.id}) } }