Descendants on GraphQL

This commit is contained in:
Luis Fernando Molina committed 2018-09-27 15:47:14 +02:00
1 parent 831acae792
commit 74ea914045
1 file changed
+8 -1
+8 -1
View File
@@ -144,7 +144,14 @@ const RootQuery = new GraphQLObjectType({
if (mongoQuery.$or.length === 0) { mongoQuery = {} }
return User.find(mongoQuery)
return User.find([mongoQuery])
}
},
descendents: {
type: new GraphQLList(UserType),
args: {id: {type: GraphQLString}},
resolve (parent, args) {
return User.find({referrerId: args.id})
}
}
}