create valid relay schema.json
This commit is contained in:
27
config/graphql/schema.js
Normal file
27
config/graphql/schema.js
Normal 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
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user