Postgraphile cannot query SQL function

Postgraphile cannot query SQL function


0

I have a SQL function that I am unable to query with Postgraphile. I am getting Cannot query field "get_eligible_shifts" on type "Query"." I noticed that in the PostGraphiQL the function does not appear. Why would I not be able to query on my SQL function?

Postgraphile query

{
  get_eligible_shifts(
    args: {workerId: 1}
  ) {
    id
    start
    end_time
    profession
    worker_name
    facility_id
    facility_name
    worker_document_id
    facility_requirement_id
  }
}

errror

{
  "errors": [
    {
      "message": "Cannot query field "get_eligible_shifts" on type "Query".",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]
}

1 Answer
1


0

get_eligible_shifts needs to be included as a query in your schema. For example:

type Query {
  get_eligible_shifts(args: ArgsInputType): [Shifts]

   ... more query definitions
}

Only once a query has been included in the schema can you resolve it using a resolver, in your case the SQL function you allude to.



Leave a Reply

Your email address will not be published. Required fields are marked *