clean up node interface
This commit is contained in:
@@ -3,17 +3,16 @@ import {
|
||||
nodeDefinitions,
|
||||
} from 'graphql-relay';
|
||||
|
||||
import DB from './../database'
|
||||
|
||||
var {nodeInterface, nodeField} = nodeDefinitions(
|
||||
(globalId) => {
|
||||
var {type, id} = fromGlobalId(globalId);
|
||||
return null;
|
||||
var {graphql_type_name, id} = fromGlobalId(globalId),
|
||||
model = DB[graphql_type_name];
|
||||
return model.findOne({where: {id: id}});
|
||||
},
|
||||
(obj) => {
|
||||
if (obj instanceof Array) {
|
||||
return Array;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
(instance) => {
|
||||
return instance.Model().graphql_type;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function(){
|
||||
viewer: {
|
||||
type: DB.User.graphql_type,
|
||||
resolve: (_, args) => {
|
||||
return DB.User.findOne({where: {username: args.username}});
|
||||
return DB.User.findOne({where: {username: 'bethany'}});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user