Closed e200 closed 6 years ago
I'm following the readme example with my already created model:
const Model = require('../model') class File extends Model { static get tableName() { return 'files' } static jsonSchema() { return { type: 'object', require: ['name'], properties: { id: { type: 'integer' }, name: { type: 'string' }, path: { type: 'string' }, description: { type: 'string' } } } } } module.exports = File
This is how I'm setting up the GraphQL:
const { builder } = require('objection-graphql') const graphql = require('express-graphql') const file = require('../models/file') const schema = builder() .model(file) .build() app.use('/graphql', graphql({ schema: schema, graphiql: true }))
When I run this on graphiQL:
{ Files(orderBy: id) { name } }
this is what I got:
{ "errors": [ { "message": "Enum type FilesPropertiesEnum must define one or more values.\n\nType Files must define one or more fields." } ] }
What I'm doing wrong?
I'm following the readme example with my already created model:
This is how I'm setting up the GraphQL:
When I run this on graphiQL:
this is what I got:
What I'm doing wrong?