{"action":"created","issue":{"url":"https://api.github.com/repos/nuwave/lighthouse/issues/207","repository_url":"https://api.github.com/repos/nuwave/lighthouse","labels_url":"https://api.github.com/repos/nuwave/lighthouse/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/nuwave/lighthouse/issues/207/comments","events_url":"https://api.github.com/repos/nuwave/lighthouse/issues/207/events","html_url":"https://github.com/nuwave/lighthouse/pull/207","id":341947137,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxOTYzMDcy","number":207,"title":"[Feat] Nested mutations","user":{"login":"spawnia","id":12158000,"node_id":"MDQ6VXNlcjEyMTU4MDAw","avatar_url":"https://avatars2.githubusercontent.com/u/12158000?v=4","gravatar_id":"","url":"https://api.github.com/users/spawnia","html_url":"https://github.com/spawnia","followers_url":"https://api.github.com/users/spawnia/followers","following_url":"https://api.github.com/users/spawnia/following{/other_user}","gists_url":"https://api.github.com/users/spawnia/gists{/gist_id}","starred_url":"https://api.github.com/users/spawnia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spawnia/subscriptions","organizations_url":"https://api.github.com/users/spawnia/orgs","repos_url":"https://api.github.com/users/spawnia/repos","events_url":"https://api.github.com/users/spawnia/events{/privacy}","received_events_url":"https://api.github.com/users/spawnia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-07-17T14:34:26Z","updated_at":"2018-07-30T06:55:25Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/nuwave/lighthouse/pulls/207","html_url":"https://github.com/nuwave/lighthouse/pull/207","diff_url":"https://github.com/nuwave/lighthouse/pull/207.diff","patch_url":"https://github.com/nuwave/lighthouse/pull/207.patch"},"body":"**Related Issue(s)**\r\n\r\nResolves #233 #208 #131\r\n\r\n**PR Type**\r\n\r\nFeature\r\n\r\n**Changes**\r\n\r\nThis introduces the option for crud mutations to contain data for multiple models in one single mutation.\r\n\r\nI used some ideas from https://www.prisma.io/docs/reference/prisma-api/mutations-ol0yuoz6go/#nested-mutations and they way they are doing nested mutations, and tried to combine that with the way Eloquent models work.\r\n\r\n**Example Schema**\r\n\r\n````graphql\r\ntype User {\r\n  id: ID!\r\n  email: String!\r\n  posts: [Post!] @hasMany\r\n}\r\n\r\ntype Post {\r\n  id: ID!\r\n  title: String!\r\n  author: User! @belongsTo\r\n}\r\n\r\ntype Mutation {\r\n  createUser(input: CreateUserInput!): User\r\n  createPost(input: CreatePostInput!): Post\r\n  updateUser(input: UpdateUserInput!): User\r\n  updatePost(input: UpdatePostInput): Post\r\n  deleteUser(id: ID!): User\r\n  deletePost(id: ID!): Post\r\n}\r\n\r\ninput CreateUserInput {\r\n  email: String!\r\n  posts: CreatePostRelation\r\n}\r\n\r\ninput CreatePostRelation {\r\n  create: [CreatePostInput!]\r\n}\r\n\r\ninput CreatePostInput {\r\n  title: String!\r\n  author: ID\r\n}\r\n\r\ninput UpdateUserInput {\r\n  id: ID\r\n  email: String\r\n  posts: UpdatePostRelation\r\n}\r\n\r\ninput UpdatePostRelation{\r\n  create: [CreatePostInput!]\r\n  update: [UpdatePostInput!]\r\n  delete: [ID!]\r\n}\r\n\r\ninput UpdatePostInput {\r\n  id: ID\r\n  title: String!\r\n  author: ID\r\n}\r\n````\r\n\r\n**Example Create**\r\n\r\n````graphql\r\nmutation {\r\n  createUser(\r\n    input: {\r\n      email: \"adf@asdf.de\"\r\n      posts: {\r\n        create: [\r\n          { title: \"post a\" }\r\n          { title: \"post b\" }\r\n        ]\r\n      }\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}\r\n````\r\n\r\n**Example Update**\r\n\r\n````graphql\r\nmutation {\r\n  updateUser(\r\n    input: {\r\n\t  id: 2\r\n      email: \"adf@asdf.de\"\r\n      posts: {\r\n        create: [\r\n          { title: \"post c\" }\r\n        ]\r\n        update: [\r\n          { id: 2, title: \"post cysadf\" }\r\n        ]\r\n        delete: [ 23, 4 ]\r\n      }\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}\r\n````"},"comment":{"url":"https://api.github.com/repos/nuwave/lighthouse/issues/comments/408765070","html_url":"https://github.com/nuwave/lighthouse/pull/207#issuecomment-408765070","issue_url":"https://api.github.com/repos/nuwave/lighthouse/issues/207","id":408765070,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODc2NTA3MA==","user":{"login":"maarten00","id":1579711,"node_id":"MDQ6VXNlcjE1Nzk3MTE=","avatar_url":"https://avatars2.githubusercontent.com/u/1579711?v=4","gravatar_id":"","url":"https://api.github.com/users/maarten00","html_url":"https://github.com/maarten00","followers_url":"https://api.github.com/users/maarten00/followers","following_url":"https://api.github.com/users/maarten00/following{/other_user}","gists_url":"https://api.github.com/users/maarten00/gists{/gist_id}","starred_url":"https://api.github.com/users/maarten00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maarten00/subscriptions","organizations_url":"https://api.github.com/users/maarten00/orgs","repos_url":"https://api.github.com/users/maarten00/repos","events_url":"https://api.github.com/users/maarten00/events{/privacy}","received_events_url":"https://api.github.com/users/maarten00/received_events","type":"User","site_admin":false},"created_at":"2018-07-30T06:55:24Z","updated_at":"2018-07-30T06:55:24Z","author_association":"CONTRIBUTOR","body":"Ran some more tests with your new code, still works great. Will have to add some explanation to the docs though about use, because of the extra argument in `@create`"}}
{"actor":{"display_login":"maarten00"}}