Closed ianberdin closed 5 years ago
Hello. Is it support?
I tried like this:
const Sequelize = require('sequelize') const { applyMiddleware } = require('graphql-middleware') const { resolver, attributeFields } = require('graphql-sequelize') const { rule, shield, and, or, not, allow } = require('graphql-shield') const { GraphQLObjectType, GraphQLSchema, GraphQLNonNull, GraphQLInt, GraphQLString, GraphQLList, } = require('graphql') const User = db.define('user', { firstName: { type: Sequelize.STRING }, lastName: { type: Sequelize.STRING }, }) let userType = new GraphQLObjectType({ name: 'User', description: 'A user', fields: attributeFields(User) }) let schema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'RootQueryType', fields: { user: { type: userType, args: { id: { description: 'id of the user', type: new GraphQLNonNull(GraphQLInt) } }, resolve: resolver(User) }, } }), }) const isAuthenticated = rule()(async ( parent, args, ctx, info ) => { return true }) const permissions = shield({ query: { user: isAuthenticated, } }) schema = applyMiddleware(schema, permissions)
But it's have error: It seems like you have applied rules to ${typeErrors} types but Shield cannot find them in your schema.
It seems like you have applied rules to ${typeErrors} types but Shield cannot find them in your schema.
graphql-sequelize has no graphql-shield specific code
Hello. Is it support?
I tried like this:
But it's have error:
It seems like you have applied rules to ${typeErrors} types but Shield cannot find them in your schema.