GraphQL mutation to add item to existing array field

Viewed 508

I have a model object that has a status log and I'd like to be able to add a new log item without having to replace the whole list. Is there a way to do this?

Here's a simplified schema. My projects have an array of StatusLog. What I'd like to do is push a new one onto the existing list without having to give the mutation the whole list each time as this will just get longer and longer.

type StatusLog {
  status: String!
  timestamp: String!
}

type Project @model @versioned {
  id: ID!
  statusLog: [StatusLog]

PS is there a command-line way to take an annotated graphql schema like this (i.e. with the @model and @versioned tags) and generate the code locally without having to go through amplify api push?

0 Answers
Related