Suppose i have the following schema:
type User{
id: ID! @unique
age: Int
email: String! @unique
name: String!
posts: [Post!]!
}
type Post {
id: ID! @unique
title: String!
published: Boolean!
author: User!
}
How can I implemented a nested mutation like:
mutation {
createPost(data: {
title: "This is a draft"
published: false
author: {
create: {
email: "athina@example.com"
name:"athina"
}
}
}) {
id
title
published
author {
name
email
}
}
}
Suppose i have the following schema: type User{ id: ID! @unique age: Int email: String! @unique name: String! posts: [Post!]! }
type Post { id: ID! @unique title: String! published: Boolean! author: User! } How can I implemented a nested mutation like: mutation { createPost(data: { title: "This is a draft" published: false author: { create: { email: "athina@example.com" name:"athina" } } }) { id title published author { name email } } }