including CAIT data, models and seeds
This commit is contained in:
27
lib/node.relay.js
Normal file
27
lib/node.relay.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* We get the node interface and field from the Relay library.
|
||||
*
|
||||
* The first method defines the way we resolve an ID to its object.
|
||||
* The second defines the way we resolve an object to its GraphQL type.
|
||||
*/
|
||||
var {nodeInterface, nodeField} = nodeDefinitions(
|
||||
(globalId) => {
|
||||
var {type, id} = fromGlobalId(globalId);
|
||||
if (type === 'PowerDatum') {
|
||||
return getUser(id);
|
||||
} else if (type === 'Widget') {
|
||||
return getWidget(id);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
(obj) => {
|
||||
if (obj instanceof User) {
|
||||
return userType;
|
||||
} else if (obj instanceof Widget) {
|
||||
return widgetType;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user