javascript – Modularização do Schema using AdonisJs e GraphQL

Note that you can use AdonisJS and Graphql, até quiet, criei or schema e defined as queries, mutations, types. Because it was centralized in just an archivist, it was decided to modularize the scheme and solve the problems.

What is the problem? How can I export the files that have been modified?

typeError: property can not be read & # 39; type & # 39; of undefined
in D:  Desenvolvimento  statsway  adonis-graphql-server  app  data  schema.js (anonymous): 30
Outline of 25 types {
26 consultation: consultation
27 mutation: mutation
28}
30 module.exports = makeExecutableSchema ({
31 typeDefs:

The
32 typeDefs,
33 Inquiry,
34 mutation,
35 types of user

A Dúvida é a seguinte, eu n posso fazer and concatenação dessa forma dentro do module.exports? Would it be a major import problem?

Follow a complete example:

UserSchema:

const userTypes = `
# Type of user definition
user type {
I dint!
username: String!
Email: String!
messages: [Post]
    }
`;

const userQueries = `
all users: [User]
    fetchUser (id: Int!): User
`;

const userMutations = `
login (email: String !, password: String!): String
createUser (username: String!, email: String!, password: String!): User
`;

module.exports = {
user types,
userQueries,
userMutations
}

Resolve user:

& # 39; strict use & # 39;
Const User = use (& # 39; App / Models / User & # 39;)

const userResolver = {
Query: {
async allUsers () {
const users = await User.all ()
returns users.toJSON ()
}
async fetchUser (_, {id}) {
const user = awaits User.find (id)
return user.toJSON ()
}
}
Mutation: {
Asynchronous login (_, {email, password}, ​​{authentication}) {
const {token} = wait auth.attempt (email, password)
return token
}

async createUser (_, {username, email, password}) {
return to wait for User.create ({username, email, password})
}
}
User: {
Asynchronous messages (userInJson) {
user const = new user ()
user.newUp (userInJson)

const posts = await user.posts (). fetch ()
return posts.toJSON ()
}
}
}
module.exports = userResolver;

Mutation:

const {userMutations} = require (& # 39; ./ user / userSchema & # 39;);

Const Mutation = `
type of mutation {
$ {userMutations}
}
`;

module.exports = Mutation

Query:

const {userQueries} = require (& # 39; ./ user / userSchema & # 39;);

const Query = `
type query {
$ {userQueries}
}
`;

module.exports = Query

Apparently, by fim or arquivo onde or erro ocorre apparently, Scheme:

& # 39; strict use & # 39;

const {makeExecutableSchema} = require (& # 39; graphql-tools & # 39;)
const {Query} = require (& # 39; ./ query & # 39;);
const {Mutation} = require (& # 39; ./ mutation & # 39;);
const {merge} = require (& # 39; lodash & # 39;);

const {userTypes} = require (& # 39; ./ user / userSchema & # 39;);
const {userResolver} = require (& # 39; ./ user / userResolver & # 39;);

const resolvers = merge (
Resolve user
)
// Define our schema using the GraphQL schema language
const typeDefs = `
write scheme {
consultation: consultation
mutation: mutation
}
`
module.exports = makeExecutableSchema ({
typeDefs: [
    typeDefs,
    Query,
    Mutation,
    userTypes,
], resolvers})

Some suggestion of what can be or problem?