{"action":"created","comment":{"url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/comments/193475496","pull_request_review_id":126438117,"id":193475496,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzQ3NTQ5Ng==","diff_hunk":"@@ -82,164 +83,197 @@ export const getDefaultMutations = (collectionName, options = {}) => {\n         Utils.performCheck(this.check, context.currentUser, document);\n \n         // call editMutator boilerplate function\n-        return await editMutator({\n-          collection, \n-          documentId: documentId, \n-          set: set, \n-          unset: unset, \n+        return await updateMutator({\n+          collection,\n+          documentId,\n+          data,\n           currentUser: context.currentUser,\n           validate: true,\n           context,\n         });\n       },\n-\n-    },\n-\n+    };\n+    mutations.update = updateMutation;\n+    // OpenCRUD backwards compatibility\n+    mutations.edit = updateMutation;\n+  }\n+  if (options.upsert) {\n     // mutation for upserting a specific document\n-    upsert: {\n-      name: `${collectionName}Upsert`,\n-\n-      description: `Mutation for upserting a ${collectionName} document`,\n+    mutations.upsert = {\n+      description: `Mutation for upserting a ${typeName} document`,\n \n-      async mutation(root, { search, set, unset }, context) {\n-        const collection = context[collectionName];\n+      async mutation(root, { input }, context) {\n+        const { selector, data } = input;\n+        const collection = context[typeName];\n \n         // check if document exists already\n-        const existingDocument = await Connectors.get(collection, search, { fields: { _id: 1 } });\n+        const existingDocument = await Connectors.get(collection, selector, { fields: { _id: 1 } });\n \n         if (existingDocument) {\n-          const editArgs = {\n-            documentId: existingDocument._id,\n-            set,\n-            unset,\n-          };\n-          return await collection.options.mutations.edit.mutation(root, editArgs, context);\n+          return await collection.options.mutations.update.mutation(root, { selector, data }, context);\n         } else {\n-          return await collection.options.mutations.new.mutation(root, { document: set }, context);\n+          return await collection.options.mutations.create.mutation(root, { data }, context);\n         }\n       },\n-    },\n-\n+    };\n+  }\n+  if (options.delete) {\n     // mutation for removing a specific document (same checks as edit mutation)\n \n-    remove: {\n+    const deleteMutation = {\n+      description: `Mutation for deleting a ${typeName} document`,\n \n-      name: `${collectionName}Remove`,\n-      \n-      description: `Mutation for deleting a ${collectionName} document`,\n-      \n       check(user, document) {\n         if (options.removeCheck) {\n           return options.removeCheck(user, document);\n         }\n-        \n+\n         if (!user || !document) return false;\n-        return Users.owns(user, document) ? Users.canDo(user, `${collectionName.toLowerCase()}.remove.own`) : Users.canDo(user, `${collectionName.toLowerCase()}.remove.all`);\n+        return Users.owns(user, document)\n+          ? Users.canDo(user, `${typeName.toLowerCase()}.remove.own`)\n+          : Users.canDo(user, `${typeName.toLowerCase()}.remove.all`);\n       },\n-      \n-      async mutation(root, {documentId}, context) {\n \n-        const collection = context[collectionName];\n+      async mutation(root, { input }, context) {\n+        const { selector } = input;\n+        const { documentId } = selector;\n+        const collection = context[typeName];\n \n         const document = await Connectors.get(collection, documentId);\n         Utils.performCheck(this.check, context.currentUser, document, context);\n \n-        return await removeMutator({\n-          collection, \n-          documentId: documentId, \n+        return await deleteMutator({","path":"packages/vulcan-core/lib/modules/default_mutations.js","position":209,"original_position":209,"commit_id":"ad1f47ef733f4755d963232ba651a3f5b3c4a7c3","original_commit_id":"ad1f47ef733f4755d963232ba651a3f5b3c4a7c3","user":{"login":"justinr1234","id":7017500,"node_id":"MDQ6VXNlcjcwMTc1MDA=","avatar_url":"https://avatars1.githubusercontent.com/u/7017500?v=4","gravatar_id":"","url":"https://api.github.com/users/justinr1234","html_url":"https://github.com/justinr1234","followers_url":"https://api.github.com/users/justinr1234/followers","following_url":"https://api.github.com/users/justinr1234/following{/other_user}","gists_url":"https://api.github.com/users/justinr1234/gists{/gist_id}","starred_url":"https://api.github.com/users/justinr1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinr1234/subscriptions","organizations_url":"https://api.github.com/users/justinr1234/orgs","repos_url":"https://api.github.com/users/justinr1234/repos","events_url":"https://api.github.com/users/justinr1234/events{/privacy}","received_events_url":"https://api.github.com/users/justinr1234/received_events","type":"User","site_admin":false},"body":"Similar comment as above, we should be passing the entire selector to the `deleteMutator` and let it handle what to do with it.","created_at":"2018-06-06T16:29:59Z","updated_at":"2018-06-06T16:44:39Z","html_url":"https://github.com/VulcanJS/Vulcan/pull/1994#discussion_r193475496","pull_request_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/comments/193475496"},"html":{"href":"https://github.com/VulcanJS/Vulcan/pull/1994#discussion_r193475496"},"pull_request":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994"}}},"pull_request":{"url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994","id":192848540,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyODQ4NTQw","html_url":"https://github.com/VulcanJS/Vulcan/pull/1994","diff_url":"https://github.com/VulcanJS/Vulcan/pull/1994.diff","patch_url":"https://github.com/VulcanJS/Vulcan/pull/1994.patch","issue_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/1994","number":1994,"state":"open","locked":false,"title":"Opencrud","user":{"login":"SachaG","id":358832,"node_id":"MDQ6VXNlcjM1ODgzMg==","avatar_url":"https://avatars3.githubusercontent.com/u/358832?v=4","gravatar_id":"","url":"https://api.github.com/users/SachaG","html_url":"https://github.com/SachaG","followers_url":"https://api.github.com/users/SachaG/followers","following_url":"https://api.github.com/users/SachaG/following{/other_user}","gists_url":"https://api.github.com/users/SachaG/gists{/gist_id}","starred_url":"https://api.github.com/users/SachaG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SachaG/subscriptions","organizations_url":"https://api.github.com/users/SachaG/orgs","repos_url":"https://api.github.com/users/SachaG/repos","events_url":"https://api.github.com/users/SachaG/events{/privacy}","received_events_url":"https://api.github.com/users/SachaG/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-05T22:00:22Z","updated_at":"2018-06-06T16:44:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b55d4e484c8b6116cd3d828c6358caa6b7f95f73","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994/commits","review_comments_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994/comments","review_comment_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/1994/comments","statuses_url":"https://api.github.com/repos/VulcanJS/Vulcan/statuses/ad1f47ef733f4755d963232ba651a3f5b3c4a7c3","head":{"label":"VulcanJS:opencrud","ref":"opencrud","sha":"ad1f47ef733f4755d963232ba651a3f5b3c4a7c3","user":{"login":"VulcanJS","id":6634779,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzQ3Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/6634779?v=4","gravatar_id":"","url":"https://api.github.com/users/VulcanJS","html_url":"https://github.com/VulcanJS","followers_url":"https://api.github.com/users/VulcanJS/followers","following_url":"https://api.github.com/users/VulcanJS/following{/other_user}","gists_url":"https://api.github.com/users/VulcanJS/gists{/gist_id}","starred_url":"https://api.github.com/users/VulcanJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VulcanJS/subscriptions","organizations_url":"https://api.github.com/users/VulcanJS/orgs","repos_url":"https://api.github.com/users/VulcanJS/repos","events_url":"https://api.github.com/users/VulcanJS/events{/privacy}","received_events_url":"https://api.github.com/users/VulcanJS/received_events","type":"Organization","site_admin":false},"repo":{"id":5710848,"node_id":"MDEwOlJlcG9zaXRvcnk1NzEwODQ4","name":"Vulcan","full_name":"VulcanJS/Vulcan","owner":{"login":"VulcanJS","id":6634779,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzQ3Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/6634779?v=4","gravatar_id":"","url":"https://api.github.com/users/VulcanJS","html_url":"https://github.com/VulcanJS","followers_url":"https://api.github.com/users/VulcanJS/followers","following_url":"https://api.github.com/users/VulcanJS/following{/other_user}","gists_url":"https://api.github.com/users/VulcanJS/gists{/gist_id}","starred_url":"https://api.github.com/users/VulcanJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VulcanJS/subscriptions","organizations_url":"https://api.github.com/users/VulcanJS/orgs","repos_url":"https://api.github.com/users/VulcanJS/repos","events_url":"https://api.github.com/users/VulcanJS/events{/privacy}","received_events_url":"https://api.github.com/users/VulcanJS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VulcanJS/Vulcan","description":"🌋 A toolkit to quickly build apps with React, GraphQL & Meteor","fork":false,"url":"https://api.github.com/repos/VulcanJS/Vulcan","forks_url":"https://api.github.com/repos/VulcanJS/Vulcan/forks","keys_url":"https://api.github.com/repos/VulcanJS/Vulcan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VulcanJS/Vulcan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VulcanJS/Vulcan/teams","hooks_url":"https://api.github.com/repos/VulcanJS/Vulcan/hooks","issue_events_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/events{/number}","events_url":"https://api.github.com/repos/VulcanJS/Vulcan/events","assignees_url":"https://api.github.com/repos/VulcanJS/Vulcan/assignees{/user}","branches_url":"https://api.github.com/repos/VulcanJS/Vulcan/branches{/branch}","tags_url":"https://api.github.com/repos/VulcanJS/Vulcan/tags","blobs_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/refs{/sha}","trees_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VulcanJS/Vulcan/statuses/{sha}","languages_url":"https://api.github.com/repos/VulcanJS/Vulcan/languages","stargazers_url":"https://api.github.com/repos/VulcanJS/Vulcan/stargazers","contributors_url":"https://api.github.com/repos/VulcanJS/Vulcan/contributors","subscribers_url":"https://api.github.com/repos/VulcanJS/Vulcan/subscribers","subscription_url":"https://api.github.com/repos/VulcanJS/Vulcan/subscription","commits_url":"https://api.github.com/repos/VulcanJS/Vulcan/commits{/sha}","git_commits_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/commits{/sha}","comments_url":"https://api.github.com/repos/VulcanJS/Vulcan/comments{/number}","issue_comment_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/comments{/number}","contents_url":"https://api.github.com/repos/VulcanJS/Vulcan/contents/{+path}","compare_url":"https://api.github.com/repos/VulcanJS/Vulcan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VulcanJS/Vulcan/merges","archive_url":"https://api.github.com/repos/VulcanJS/Vulcan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VulcanJS/Vulcan/downloads","issues_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues{/number}","pulls_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls{/number}","milestones_url":"https://api.github.com/repos/VulcanJS/Vulcan/milestones{/number}","notifications_url":"https://api.github.com/repos/VulcanJS/Vulcan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VulcanJS/Vulcan/labels{/name}","releases_url":"https://api.github.com/repos/VulcanJS/Vulcan/releases{/id}","deployments_url":"https://api.github.com/repos/VulcanJS/Vulcan/deployments","created_at":"2012-09-07T01:13:24Z","updated_at":"2018-06-06T08:20:33Z","pushed_at":"2018-06-06T10:51:01Z","git_url":"git://github.com/VulcanJS/Vulcan.git","ssh_url":"git@github.com:VulcanJS/Vulcan.git","clone_url":"https://github.com/VulcanJS/Vulcan.git","svn_url":"https://github.com/VulcanJS/Vulcan","homepage":"http://vulcanjs.org","size":12259,"stargazers_count":6813,"watchers_count":6813,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2050,"mirror_url":null,"archived":false,"open_issues_count":105,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2050,"open_issues":105,"watchers":6813,"default_branch":"devel"}},"base":{"label":"VulcanJS:devel","ref":"devel","sha":"c70f32a52a94fe5f6d1dcc7700066a1a1c3ccf21","user":{"login":"VulcanJS","id":6634779,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzQ3Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/6634779?v=4","gravatar_id":"","url":"https://api.github.com/users/VulcanJS","html_url":"https://github.com/VulcanJS","followers_url":"https://api.github.com/users/VulcanJS/followers","following_url":"https://api.github.com/users/VulcanJS/following{/other_user}","gists_url":"https://api.github.com/users/VulcanJS/gists{/gist_id}","starred_url":"https://api.github.com/users/VulcanJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VulcanJS/subscriptions","organizations_url":"https://api.github.com/users/VulcanJS/orgs","repos_url":"https://api.github.com/users/VulcanJS/repos","events_url":"https://api.github.com/users/VulcanJS/events{/privacy}","received_events_url":"https://api.github.com/users/VulcanJS/received_events","type":"Organization","site_admin":false},"repo":{"id":5710848,"node_id":"MDEwOlJlcG9zaXRvcnk1NzEwODQ4","name":"Vulcan","full_name":"VulcanJS/Vulcan","owner":{"login":"VulcanJS","id":6634779,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzQ3Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/6634779?v=4","gravatar_id":"","url":"https://api.github.com/users/VulcanJS","html_url":"https://github.com/VulcanJS","followers_url":"https://api.github.com/users/VulcanJS/followers","following_url":"https://api.github.com/users/VulcanJS/following{/other_user}","gists_url":"https://api.github.com/users/VulcanJS/gists{/gist_id}","starred_url":"https://api.github.com/users/VulcanJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VulcanJS/subscriptions","organizations_url":"https://api.github.com/users/VulcanJS/orgs","repos_url":"https://api.github.com/users/VulcanJS/repos","events_url":"https://api.github.com/users/VulcanJS/events{/privacy}","received_events_url":"https://api.github.com/users/VulcanJS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VulcanJS/Vulcan","description":"🌋 A toolkit to quickly build apps with React, GraphQL & Meteor","fork":false,"url":"https://api.github.com/repos/VulcanJS/Vulcan","forks_url":"https://api.github.com/repos/VulcanJS/Vulcan/forks","keys_url":"https://api.github.com/repos/VulcanJS/Vulcan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VulcanJS/Vulcan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VulcanJS/Vulcan/teams","hooks_url":"https://api.github.com/repos/VulcanJS/Vulcan/hooks","issue_events_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/events{/number}","events_url":"https://api.github.com/repos/VulcanJS/Vulcan/events","assignees_url":"https://api.github.com/repos/VulcanJS/Vulcan/assignees{/user}","branches_url":"https://api.github.com/repos/VulcanJS/Vulcan/branches{/branch}","tags_url":"https://api.github.com/repos/VulcanJS/Vulcan/tags","blobs_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/refs{/sha}","trees_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VulcanJS/Vulcan/statuses/{sha}","languages_url":"https://api.github.com/repos/VulcanJS/Vulcan/languages","stargazers_url":"https://api.github.com/repos/VulcanJS/Vulcan/stargazers","contributors_url":"https://api.github.com/repos/VulcanJS/Vulcan/contributors","subscribers_url":"https://api.github.com/repos/VulcanJS/Vulcan/subscribers","subscription_url":"https://api.github.com/repos/VulcanJS/Vulcan/subscription","commits_url":"https://api.github.com/repos/VulcanJS/Vulcan/commits{/sha}","git_commits_url":"https://api.github.com/repos/VulcanJS/Vulcan/git/commits{/sha}","comments_url":"https://api.github.com/repos/VulcanJS/Vulcan/comments{/number}","issue_comment_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues/comments{/number}","contents_url":"https://api.github.com/repos/VulcanJS/Vulcan/contents/{+path}","compare_url":"https://api.github.com/repos/VulcanJS/Vulcan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VulcanJS/Vulcan/merges","archive_url":"https://api.github.com/repos/VulcanJS/Vulcan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VulcanJS/Vulcan/downloads","issues_url":"https://api.github.com/repos/VulcanJS/Vulcan/issues{/number}","pulls_url":"https://api.github.com/repos/VulcanJS/Vulcan/pulls{/number}","milestones_url":"https://api.github.com/repos/VulcanJS/Vulcan/milestones{/number}","notifications_url":"https://api.github.com/repos/VulcanJS/Vulcan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VulcanJS/Vulcan/labels{/name}","releases_url":"https://api.github.com/repos/VulcanJS/Vulcan/releases{/id}","deployments_url":"https://api.github.com/repos/VulcanJS/Vulcan/deployments","created_at":"2012-09-07T01:13:24Z","updated_at":"2018-06-06T08:20:33Z","pushed_at":"2018-06-06T10:51:01Z","git_url":"git://github.com/VulcanJS/Vulcan.git","ssh_url":"git@github.com:VulcanJS/Vulcan.git","clone_url":"https://github.com/VulcanJS/Vulcan.git","svn_url":"https://github.com/VulcanJS/Vulcan","homepage":"http://vulcanjs.org","size":12259,"stargazers_count":6813,"watchers_count":6813,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2050,"mirror_url":null,"archived":false,"open_issues_count":105,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2050,"open_issues":105,"watchers":6813,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994"},"html":{"href":"https://github.com/VulcanJS/Vulcan/pull/1994"},"issue":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/issues/1994"},"comments":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/issues/1994/comments"},"review_comments":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994/comments"},"review_comment":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/pulls/1994/commits"},"statuses":{"href":"https://api.github.com/repos/VulcanJS/Vulcan/statuses/ad1f47ef733f4755d963232ba651a3f5b3c4a7c3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"justinr1234"}}