Would you do something like this?
// ROOT QUERY
// ========================
const RootQuery = new GraphQLObjectType({
name: 'RootQueryType',
fields: {
user: {
type: UserType,
args: { id: { type: GraphQLString } },
resolve(parentValue, args) {
return Meteor.call('getUser');
}
},
company: {
type: CompanyType,
args: { id: { type: GraphQLString } },
resolve(parentValue, args) {
return Meteor.call('getCompany');
}
}
}
});
or
// ROOT QUERY
// ========================
const RootQuery = new GraphQLObjectType({
name: 'RootQueryType',
fields: {
user: {
type: UserType,
args: { id: { type: GraphQLString } },
resolve(parentValue, args) {
return Meteor.users.findOne({_id: this.userId});
}
},
company: {
type: CompanyType,
args: { id: { type: GraphQLString } },
resolve(parentValue, args) {
return Companies.findOne({_id: args._id});
}
}
}
});
Is there an upside or downside to either or?
and a follow up, are folks using simple-schema still or just relying on the mutation schema to allow/deny accordingly? I suppose you can avoid using simple-schema on smaller apps where Mongo is your main data store?