Created
November 6, 2015 05:12
-
-
Save saikat/21e4bd36404255578f95 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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