Backend Boilerplates
typescript
Advanced
TypeORM Soft Delete Base Entity
Base entity class with soft delete, createdAt and updatedAt columns for TypeORM.
typescript
import { CreateDateColumn, DeleteDateColumn, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
export abstract class BaseEntity {
@PrimaryGeneratedColumn('uuid') id: string;
@CreateDateColumn() createdAt: Date;
@UpdateDateColumn() updatedAt: Date;
@DeleteDateColumn() deletedAt?: Date;
}
// Extend and use withDeleted() to include soft-deleted rows.
Prerequisites
- typeorm >= 0.3
- reflect-metadata
Pro Tips
- → Use softDelete() method on repository.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- typescript
- Level
- Advanced
- Read time
- 3 min
- Published
- Sep 2024
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
Laravel Artisan Seeder Command
Artisan command to re-seed production data with a confirmation prompt.
php
·
Intermediate
CSV to PostgreSQL Bulk Loader
Stream a large CSV directly into PostgreSQL using COPY for maximum throughput.
python
·
Intermediate
Go Event Sourcing Store
Minimal append-only event store in Go backed by a Postgres table.
go
·
Advanced