Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Fix create mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentuso committed Apr 20, 2018
1 parent 849867e commit 2e70734
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mutation/create/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default ({ className, displayName, fields }, Type) => ({
type: Type,
description: `Create a new ${displayName}`,
args: {
data: {
input: {
type: inputType({ className, displayName, fields }),
},
newAttributes: {
Expand All @@ -15,13 +15,13 @@ export default ({ className, displayName, fields }, Type) => ({
}
},
resolve(value, args, { sessionToken }) {
const { data, newProperties } = args;
if (newProperties && 'objectId' in newProperties) {
const { input, newAttributes } = args;
if (newAttributes && 'objectId' in newAttributes) {
throw new Error('objectId not allowed in a create mutation');
}
const object = new Parse.Object(className, {
...data,
...newProperties,
...input,
...newAttributes,
});
return object.save({ sessionToken });
},
Expand Down

0 comments on commit 2e70734

Please sign in to comment.