docs: Include info about using soft delete in Repository API (#10722)

This commit is contained in:
Jacob Sánchez 2025-01-05 21:07:18 +00:00 committed by GitHub
parent 4d319020ff
commit 025318b8c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -224,14 +224,18 @@ await repository.delete([1, 2, 3])
await repository.delete({ firstName: "Timber" })
```
- `softDelete` and `restore` - Soft deleting and restoring a row by id
- `softDelete` and `restore` - Soft deleting and restoring a row by id, ids, or given conditions:
```typescript
const repository = dataSource.getRepository(Entity)
// Delete a entity
// Soft delete an entity
await repository.softDelete(1)
// And You can restore it using restore;
// And you can restore it using restore;
await repository.restore(1)
// Soft delete multiple entities
await repository.softDelete([1, 2, 3])
// Or soft delete by other attribute
await repository.softDelete({ firstName: "Jake" })
```
- `softRemove` and `recover` - This is alternative to `softDelete` and `restore`.