# @delete

{% hint style="warning" %}
Required arguments for writing a mutation:

* id - Int! / \[Int!]! / String! / \[String!]! / ID! / \[ID!]!
  {% endhint %}

### For a separate add use

```javascript
/* ... */
const {
  DeleteDirective,
  DeleteTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/mutation/Delete')

makeExecutableSchema({ 
  /* ... */ 
  typeDefs: [ DeleteTypeDefs, /* ... */ ],
  schemaDirectives: { DeleteDirective, /* ... */} 
})
```

### Definition

{% code title="DeleteTypeDefs" %}

```graphql
directive @delete(
  # By default, the model will be calculated from the name
  # of the returned "type" with the prefix 'App/Model/'
  model: String) on FIELD_DEFINITION
```

{% endcode %}

{% hint style="success" %}
:thinking: Carefully describe the mutation!

If you assign a different set to the input and output, this will throw an exception

> :exclamation: Error: Different sets are installed for input and output.
> {% endhint %}

{% hint style="info" %}
Delete directive deletes by primary key of model
{% endhint %}

### Example

```graphql
type Mutation {
    deletePost(id: String!): Post @delete
    deleteManyPost(id: [String!]!): [Post] @delete
}
```
