How can I delete the items that have a relation to another item in AppSync/Amplify?

Viewed 598

I'm using the provided mutations that were created with AWS Amplify. I can delete the 'Store' object on its own using the provided delete function that Amplify generates, but the Product items that have a relation will remain. I know I could delete the Product Items individually, but I wanted to see if there was a more efficient way of doing this.

This is an example schema of what the relation looks like:

type Store @model {
  id: ID!
  products: [Product] @connection(name:"StoreProducts",sortField:"createdAt")
  createdAt: AWSDateTime
}

type Product @model {
  id: ID!
  Store: Store @connection(name:"StoreProducts")
  value: String!
  createdAt: AWSDateTime
} 
0 Answers
Related