Last active
October 8, 2017 16:57
Revisions
-
rubycut revised this gist
Oct 8, 2017 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,8 @@ import {Cluster} from './cluster.js' const graphqlFields = require('graphql-fields'); import * as _ from 'lodash' const resolvers = { Query: { customer(root, args, context,info) { -
rubycut revised this gist
Oct 8, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ const resolvers = { var requested_fields = Object.keys(graphqlFields(info)) var c = Cluster.findForUser(context,args.id) if(_.includes(requested_fields, 'contacts')) { c = c.populate('contacts') } return c.then((data) => { -
rubycut created this gist
Oct 8, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ const resolvers = { Query: { customer(root, args, context,info) { var requested_fields = Object.keys(graphqlFields(info)) var c = Cluster.findForUser(context,args.id) if(_.includes(requested_fields, 'groups')) { c = c.populate('groups') } return c.then((data) => { return [ data ] }).catch(error => { console.log(error) }); } } }