User Search Working Again
This commit is contained in:
1 parent
8ca1e2e592
commit
7b784b7ef2
2 files changed
+7
-2
No files matched your search
@@ -156,6 +156,7 @@ class UserSearch extends Component {
|
||||
if (data.loading) {
|
||||
return (<div> Loading Users... </div>)
|
||||
} else {
|
||||
console.log(data)
|
||||
if (data.usersSearch === undefined) {
|
||||
return (<div> No Users to Display </div>)
|
||||
} else {
|
||||
|
||||
@@ -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})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user