Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for empty operator in buildGetListVariables #125

Merged

Conversation

ofilipowicz
Copy link
Contributor

@ofilipowicz ofilipowicz commented Aug 9, 2022

I had a case where I needed a filter that will list all orders without a review. According to Hasura docs, that's how it should be done: https://hasura.io/docs/latest/queries/postgres/query-filters/#fetch-if-nested-objects-existdo-not-exist

I was unable to do so with the current conditions in buildGetListVariables.ts. I added a condition that allows {} as an operation. It generates an empty operator instead of a default _eq.

It allowed me to write a filter with source="_not#review@{}" that generates this kind of query:

query OrdersWithoutReviews {
  orders(where: {_and: [{_not: {review: {}}}]}) {
    review {
      id
    }
  }
}

@arjunyel arjunyel merged commit f4ed9ba into hasura:master Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants