Minor Changes
-
#5409
0026fe34d0
Thanks @BatuhanW! - feat: addgqlQuery
andgqlMutation
support.Previously,
@refinedev/nestjs-query
package only supported GraphQL operations throughmeta.fields
.Now we've added
gqlQuery
andgqlMutation
fields inmeta
object.You can utilize these fields along with
graphql-tag
package to build your queries/mutations.See the updated documentation for more information: https://refine.dev/docs/packages/data-providers/nestjs-query
Query Example:
import { useList } from "@refinedev/core"; import gql from "graphql-tag"; const PRODUCTS_QUERY = gql` query ProductsList( $paging: OffsetPaging! $filter: BlogPostFilter $sorting: [BlogPostSort!]! ) { products(paging: $paging, filter: $filter, sorting: $sorting) { nodes { id name } totalCount } } `; const { data } = useList({ resource: "products", meta: { gqlQuery: PRODUCTS_QUERY }, });
Mutation Example:
import { useForm } from "@refinedev/core"; import gql from "graphql-tag"; const CREATE_PRODUCT_MUTATION = gql` mutation CreateProduct($input: CreateProductInput!) { createOneProduct(input: $input) { id name } } `; const { formProps } = useForm({ resource: "products", meta: { gqlMutation: CREATE_PRODUCT_MUTATION }, });