Questions tagged [graphql-mutation]

129 questions
1
vote
0 answers

Get only the newly created data in graphql mutation resposne

I have following mutation from shopify graphql to add a variant to an existing product Query mutation UpdateProductMutation ($id: ID!, $options: [String!], $variants: [ProductVariantInput!]) { productUpdate(input: {id: $id, options: $options,…
java_doctor_101
  • 3,287
  • 4
  • 46
  • 78
1
vote
0 answers

How can we parse and modify a schema with makeAugmentedSchema

Related question. I'm trying to add the internationalization feature to my database. It would be quite difficult to maintain a schema graphql if I needed to duplicate all translatable fields I'm already using makeAugmentedSchema with…
1
vote
0 answers

How to execute a directive before a mutation is committed to the database?

I'm trying to add the internationalization feature to my database. It would be quite difficult to maintain a schema graphql if I needed to duplicate all translatable fields type Quest { name @i18n # simple } type Quest { nameEn …
1
vote
1 answer

Is it possible to define an Object inside InputType? or can i define an InputType inside an InputType?

A survey contains an array of question. Is it possible to have an array of InputType or Question? @InputType() export class SurveyInput { @Field(() => String) name: string @Field(() => String) status: string @Field(() => String) …
1
vote
1 answer

How to wait for multiple graphql mutations to finish then call another function

Basically I have an array of objects and based from that array's length, I need to do a mutation for each instance like so: arrayOfObjects.forEach((object) => { someGraphQlMutation({ variables: object.id, }); }); ----------------- const…
catandmouse
  • 11,309
  • 23
  • 92
  • 150
1
vote
0 answers

How to run a mutation in react native using graphql-js-client?

I am using graphql-js-client for running mutations in react native (For Shopify mobile app). Is there any way to execute the mutations directly? The following is what I have made so far for customerCreate mutation. import client from…
Jinto Antony
  • 458
  • 8
  • 26
1
vote
2 answers

How can a graphql variable be used in permission in Hasura?

I have a mutation. How can I create a permission in hasura using variables in the graphql query? eg: mutation MyMutation($name:String!) { insert_post(objects: {name:$name}){ name } } How can I use name variable in the permission?
1
vote
0 answers

How to pass the result(response) of a GraphQL query to a mutation as an argument(input)?

I'm building a cli application using GitHub API V4. I need to remove all labels a repository has. URL: https://api.github.com/graphql HEADERS: Accept: application/vnd.github.bane-preview+json Authorization: bearer I need to get the…
1
vote
1 answer

Data Relationships and Connection Types with Mutations in Prisma, GraphQL, and Apollo

Sorry for the long post, but I tried to be as detailed as possible. How can I edit my current model, schema, and resolver to be able to save/connect a related type (Vendor) to my created type (Item) via a web form? I want to create an inventory item…
1
vote
2 answers

Delete and Update Graphql mutation in Amplify ReactJs

Amplify automatically generates mutations for delete like this: export const deleteTodo = /* GraphQL */ ` mutation DeleteTodo($input: DeleteTodoInput!) { deleteTodo(input: $input) { index body hasRead } and this is how I call it in my…
Hector
  • 45
  • 7
1
vote
1 answer

Graphql Hasura Update if the field is not null

I have a graphql type which I would like to update based on the value of one column. For example the type has the following columns: id, col1, col2, col3 so I would like to update col3 if only if col1 has a value. I am using react as frontend and…
Jacob
  • 11
  • 2
1
vote
1 answer

GraphQL mutation "Cannot set headers after they are sent to the client"

I'm implementing graphql login mutation to authenticate user login credential. Mutation verifies the password with bcrypt then sends a cookie to the client, which will render user profile based on whether the cookie is a buyer or owner user).…
jche
  • 129
  • 2
  • 16
1
vote
1 answer

GraphQL Mutation Insert using Inner Query

How can I perform the following SQL Insert Query as a GraphQL Mutation Insert? INSERT INTO User (id, name, user_type_id) VALUES (1, "Name", (SELECT id FROM UserType WHERE user_type="Guest")) Provided that there is a One to Many relation from…
gzone
  • 31
  • 7
1
vote
1 answer

How to send byte array (Blob) to GraphQL mutation

We have a GraphQL mutation with a byte array (Blob) field. How can I use tools like Insomnia or GraphQL playground to send byte array data to test the API? mutation { saveSomething(something: { contentByteArray: [97, 110, 103, 101, 108, 111] …
angelokh
  • 9,426
  • 9
  • 69
  • 139
1
vote
0 answers

What are best practices for graphql mutations? (.NET implementation)

I am currently learning graphql and I am not sure if I correctly understand how mutations are supposed to work, especially when combined with subscriptions. I have a page with client details, that include a description and a list of software…
kanpeki
  • 435
  • 2
  • 6
  • 20
1 2 3
8 9