How to conditionally delete in DynamoDB using AppSync and Amplify

186 views Asked by At

I'm a newbie to DynamoDB and AppSync. I have a Tasks table and a TaskType table.

type TaskType
@model
@key(name: "tasktypesOrgIndex", fields: ["orgID"], queryField: "tasktypesByOrganization")
{
  id: ID!
  orgID: ID!
  name:  String!
  description: String!
  type: TaskKeyword
  task:[Task] @connection
}

type Task
@model
{
  id: ID!
  orgID: ID!
  name:  String!
  description: String!
  type: TaskKeyword
}

enum TaskKeyword {
  TASK
  SUBTASK
}

When someone tries to delete an entry from TaskType that has associated Tasks, I need to stop him from doing so. How can I do this?

0

There are 0 answers