> For the complete documentation index, see [llms.txt](https://cross-packages.gitbook.io/cross-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cross-packages.gitbook.io/cross-api/services/soft-delete.md).

# SoftDelete

Security delete, receives as parameter the type of the entity to invalidate it or a { key: value } type and invalidates all related data (does not delete them).

```typescript
const example = await this.examplesRepository.findBy(
  { where: { id: 123 } },
  trx,
);

if (!example) {
  throw new AppError("NOT_FOUND", "Example not found");
};

await this.examplesRepository.softDelete({ id: example.id }, trx);

// invalidate example
```

```typescript
await this.examplesRepository.softDelete({ name: "example" }, trx);

// invalidate all where name = example
```

***
