create valid relay schema.json

This commit is contained in:
Eric Hulburd
2016-01-31 17:18:27 -06:00
parent 2c42090cd9
commit c0efde030d
20 changed files with 90004 additions and 266 deletions

27
config/graphql/schema.js Normal file
View File

@@ -0,0 +1,27 @@
import {
GraphQLObjectType,
GraphQLSchema
} from 'graphql';
import {nodeField} from './node';
import DB from './../database';
export default function(){
var queryType = new GraphQLObjectType({
name: 'Query',
fields: () => ({
node: nodeField,
viewer: {
type: DB.User.graphql_type,
resolve: (_, args) => {
return DB.User.findOne({where: {username: args.username}});
}
},
}),
});
return new GraphQLSchema({
query: queryType
});
}