-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[FEAT] Passing arbitrary graphql variables to hasura dataProvider #5864
Comments
Hello @tomoemon, thanks for the issue. It seems like a good idea, but can you give me the GQL Query you want to generate so I can better understand the problem? Maybe we can make CrudFilter[] to support this. |
@alicanerdurmaz Thank you for your response! For example, I want to execute the following query Trying to get a list of categories that have at least one Posts with the string "test" in the title. query Categories {
categories(
where: {
posts_aggregate: {
count: {
predicate: { _gte: 1 },
filter: {
content: { _ilike: "%test%" }
}
}
}
}
) {
id
title
}
} schema type Posts {
id: ID!
title: String!
content: String!
categories: Categories!
}
type Categories {
id: ID!
title: String!
posts: [Posts!]!
posts_aggregate: posts_aggregate!
} In my opinion, such a condition would be too complex to add to the CrudFilter. Writing complex filter conditions without type completion may also cause bugs. |
@tomoemon Thanks for the detailed explanation, we'll see what we can do. |
Hey @tomoemon I think you should use https://refine.dev/docs/data/packages/hasura/#usage-with-graphql-tag |
@BatuhanW Do you mean that I should put a specific filter condition directly on the where argument in the gql tagged query? |
Hey @tomoemon, you are right. I think we can accept extra |
We are open to contributions for this. This feature can be applied to following packages:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi @aliemir can you please assign this ticket to me? I've begun working on adding support for this enhancement! 🚀 |
Hey @Sergio16T assigned! Let us know if you have any issues 🙏 |
Hello @aliemir, @BatuhanW, @alicanerdurmaz I've opened an initial draft PR! The PR description contains notes on pending work that was out of scope for initial changes as well as some questions to consider about desired functionality for Currently the changes apply the The scope of this PR includes |
Is your feature request related to a problem? Please describe.
I am very pleased that gqlQuery allows us to perform arbitrary GraphQL Queries against hasura.
#5489
However, it is not possible to use hasura's powerful filters because only CrudFilter[] can be passed to filters in the useTable. It is also not possible to use variables type information generated by graphql codegen.
In my case.
Given a type with the relation User has many Books, I can write a query in hasura to get a list of Users who have 3 or more Books, which is not possible in the current CrudFilter.
Describe alternatives you've considered
added to the following line in hasura dataProvider.
https://github.com/refinedev/refine/blob/master/packages/hasura/src/dataProvider/index.ts#L181
This allows the addition of any where condition supported by hasura, using type information hints, as follows.
Additional context
No response
Describe the thing to improve
gqlVariables?: any
toGraphQLQueryOptions
meta.gqlVariables
ingetList
,getMany
of hasura dataProviderThe text was updated successfully, but these errors were encountered: