Custom Graphql query inputs

Hello, Can someone please explain to me how to write custom Graphql queries? We are using the Pothos library that autogenerates all of the CRUD resolvers. I would like to use those queries for some basic create, update, and listings in the table. I understand that @pankod/refine-graphql is not doing schema introspection and it is creating its own inputs For a basic query { barbers { id, name } } It is creating query ($sort: String, $where: JSON) { barbers (sort: $sort, where: $where) { id, name } } I've tried to create my own query using gql-query-builder and set it to useTable metaData, but dataProvider is still adding* $sort: String, $where: JSON* My question is, is it possible to use default dataProvider by just sending custom queries, or do I need to create a new dataProvider that will need to handle all the use cases of various queries/mutations and create a query for it inside that dataProvider? There is no documentation for custom queries. I've found a couple of the same questions and didn't understand what was the solution to this. https://discord.com/channels/837692625737613362/890159787621355521/979168892125581342 https://discord.com/channels/837692625737613362/890159787621355521/993207528575995984 My barbers query looks like this: Query barbers ( cursor BarberWhereUniqueInput, distinct [BarberScalarFieldEnum!], orderBy [BarberOrderByWithRelationInput!], skip Int, take Int, where BarberWhereInput ) [Barber!]! And his where input like this: BarberWhereInput FIELDS AND [BarberWhereInput!] appointments AppointmentListRelationFilter barberServices BarberServiceListRelationFilter barberWorkTimeOverrides BarberWorkTimeOverrideListRelationFilter barberWorkTimes BarberWorkTimeListRelationFilter id StringFilter name StringFilter NOT [BarberWhereInput!] OR [BarberWhereInput!] password StringFilter timeSlots TimeSlotListRelationFilter type EnumBarberTypeFilter username StringFilter
No description
No description
No description
Omer
Omer577d ago
Hi @zgajo 👋, You can override spesific functions of dataProvider according to your API requirements ⚡️ https://refine.dev/docs/faq/#how-i-can-override-specific-function-of-data-providers Or you can send raw graphql queries with metaData
FAQ | refine
How can I change the form data before submitting it to the API?
constant-blue
constant-blue577d ago
Ok, so I need to override getList function, and handle adding where field and its input operations name, if filters is sent into getList function? And this needs to be handled for each getList query resource and depending on it create gql query? Isn't it easier to use introspection for this. React-admin is using introspection and I've just little addapted their Prisma graphql data profider for my use case, and that worked like a charm
Omer
Omer577d ago
I think you can handle this in dataProvider. Have you checked our hasura data provider? https://github.com/refinedev/refine/blob/next/packages/hasura/src/dataProvider/index.ts#L208
GitHub
refine/index.ts at next · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at next · refinedev/refine
constant-blue
constant-blue577d ago
Thanks for your reply @Omer
Omer
Omer577d ago
both have pros and cons, but we are working on a new data provider approach 🚀
constant-blue
constant-blue577d ago
ok, thanks... I'll give it a try tomorrow and see where I get with it
More Posts
Auzure AD B2C for Authentication and AuthorizationHi All, I am trying to set up auth with Azure AD. After a successful login on Azure AD B2C, I am redqueryOptionsI want to hit an Api with a specific route, for exampe, lets say api/user-directories/ for example Add smooth scroll effect in iconsHey everyone I want to made some changes in footer section of the this website but I'm not able to fHide *Button for forbidden actionsHi! Is there a way to avoid the disabled button for actions an user cannot do (because unauthorized)difference between importing from refinecore and refineantdfor example i have a component useSelect so if i import it from refinecore it dont have same props cI am getting 301 status using refine-simple-rest although there is not any error on postman.I am using refine-simple-rest as my data provider to connect with the django rest API but I get backchange label of breadcrumbi am using breadcrumb in create page but i am getting its as patients/create i want to change labeluseSelect onSearch without call API cos i got limit call APIcan i call API once and search query without recall API?How to submit a modal form to create a Comment when you are in the Post show page?Given the fact that I'm a first timer using React, Building refine app has been amazing. What I'd liMaking duplicate calls in the apiUsing the github example (finefoods - mui), the application is making duplicate calls in the api Docustom route element not visible{ element:<div> <LayoutWrapper>sssshhhhh</LayoutWrapper> </divpagination not working if i use filtered value and onfilter props in ant table columnfilteredValue={[consultationState]} onFilter={(value:any,record:any)=>{ return recorduseform-metadataBut the error is coming from the UserWithRolesRemove useModal form titleI want to remove title from useModalForm so i gave title ={null } its not workinguseExport with arrays in schemaI have resources that have array fields, which I am spreading to fields like `arrayItem.0.name, arrastartswith operatorstartswith operator not supported