Unknown column 'getContent.movie_id' in 'field list

好久不见. 提交于 2019-12-13 03:55:03

问题


my whole schema

const Films =  new GraphQLObjectType({
  name: 'films',
  interfaces: () => [MovieStream],

  fields: () => ({
    movie_id: {
        type: GraphQLString,

      },
    id:{
        type: GraphQLID
      },
      name: {
        type: GraphQLString,

      },

    })
})
Films._typeConfig = {
    sqlTable: "films",
    uniqueKey: 'id',

  }

  const MovieStream = new GraphQLInterfaceType({
    name: 'MovieStream',

    fields: () => ({
        id: {
            type: GraphQLID,

          },

          movie_id: {
              type: GraphQLString,

            },       
    })


})

      MovieStream._typeConfig = {
        sqlTable: "movie_streams",
        uniqueKey: 'id'
      }


      const QueryRoot = new GraphQLObjectType({
        name: 'Query',
        fields: () => ({
          getContentList:{
              type: new GraphQLList(Films),
              args: {
                id: {
                  type: GraphQLInt
                },
                permalink: {
                    type: GraphQLString
                },
                language: {
                    type: GraphQLString
                },
                content_types_id: {
                    type: GraphQLString
                },
                oauth_token:{
                    type: GraphQLString
                }

              },

              resolve: (parent, args, context, resolveInfo) => {

                               return joinMonster.default(resolveInfo,{}, sql => {
                                  return FilmDb.query(sql).then(function(result) { 

                                      return result[0];
                                  });   
                              } ,{dialect: 'mysql'});          
              },

          }

        })
      })

      module.exports = new GraphQLSchema({
          query: QueryRoot
      })

I have again modified my code still got the error

{
  "errors": [
    {
      "message": "Unknown column 'getContent.movie_id' in 'field list'",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "getContentList"
      ]
    }
  ],
  "data": {
    "getContentList": null
  }
}

My previous post Is it possible to fetch data from multiple tables using GraphQLList

Please check and tell me where i am wrong??? I have already add the field still it does not access the field of that object type

来源:https://stackoverflow.com/questions/55179820/unknown-column-getcontent-movie-id-in-field-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!