house, power, energy data generators, savers
This commit is contained in:
19
server/config/graphql/node.js
Normal file
19
server/config/graphql/node.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import {
|
||||
fromGlobalId,
|
||||
nodeDefinitions,
|
||||
} from 'graphql-relay';
|
||||
|
||||
import DB from './../database'
|
||||
|
||||
var {nodeInterface, nodeField} = nodeDefinitions(
|
||||
(globalId) => {
|
||||
var {graphql_type_name, id} = fromGlobalId(globalId),
|
||||
model = DB[graphql_type_name];
|
||||
return model.findOne({where: {id: id}});
|
||||
},
|
||||
(instance) => {
|
||||
return instance.Model().graphql_type;
|
||||
}
|
||||
);
|
||||
|
||||
export {nodeInterface, nodeField};
|
||||
Reference in New Issue
Block a user