Skip to content

Instantly share code, notes, and snippets.

@saikat
Created November 6, 2015 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saikat/21e4bd36404255578f95 to your computer and use it in GitHub Desktop.
Save saikat/21e4bd36404255578f95 to your computer and use it in GitHub Desktop.
var {nodeInterface, nodeField} = nodeDefinitions(
(globalId) => {
var {type, id} = fromGlobalId(globalId);
if (type === 'Person')
return Person.get(id);
if (type === 'Group')
return Group.get(id);
if (type === 'CallAssignment')
return CallAssignment.get(id);
if (type === 'Call')
return Call.get(id);
if (type === 'Survey')
return Survey.get(id);
if (type === 'GroupCall')
return GroupCall.get(id);
return null;
},
(obj) => {
if (obj instanceof Person)
return GraphQLPerson;
if (obj instanceof Group)
return GraphQLGroup;
if (obj instanceof CallAssignment)
return GraphQLCallAssignment;
if (obj instanceof Call)
return GraphQLCall;
if (obj instanceof Survey)
return GraphQLSurvey;
if (obj instanceof GroupCall)
return GraphQLGroupCall;
return null;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment