I dont understad what happen here.
This is my schema:
type MonthResume @model @auth(rules: [{allow: owner, identityClaim: "sub"}]){
id: ID!
incomes: Float!
spendingByCategory: [Category]
}
type Category @model @auth(rules: [{allow: owner, identityClaim: "sub"}]){
id: ID!
name: String!
amount: Float!
}
This is the autogenerated update mutation that Amplify gives to me:
export const updateMonthResume = /* GraphQL */ `
mutation UpdateMonthResume(
$input: UpdateMonthResumeInput!
$condition: ModelMonthResumeConditionInput
) {
updateMonthResume(input: $input, condition: $condition) {
id
incomes
spendingByCategory {
id
name
amount
createdAt
updatedAt
owner
}
createdAt
updatedAt
owner
}
}
`;
And this is my input:
{
"input": {
"id": "d7f-ee2971fd3ae5",
"incomes": 220,
"spendingByCategory": null,
"createdAt": "2020-08-15T17:06:22.192Z",
"updatedAt": "2020-08-15T17:06:22.192Z",
"owner": "subId"
}
}
I just want update the incomes amount, fot that reason I call the api in this way:
const input = {
incomes: 0,
}
await API.graphql(graphqlOperation(updateMonthResume, input));
And then, I got the error.
I dont understand, I dont want to update more than the income, does I need change my input? But I sent a null (Amplify does automatically) for the objetc spendingByCategory.
input CreateMonthResumeInput {
id: ID
incomes: Float!
}