Getting Started
This library enhances the @softkit/typeorm library by providing essential base services for your application. It also integrates seamlessly with the @softkit/exceptions library for standardized exception handling.
Installation
To get started, install the library using the following command:
yarn add @softkit/service-api
Quick Overview
The TypeORM Service Library offers two core services:
BaseEntityService: Facilitates CRUD operations and can be extended for custom business logic.BaseTenantEntityService: Similar toBaseEntityService, but tailored for multi-tenant applications.
Both services support generic exclusion of auto-generated fields, enhancing type safety and minimizing development errors.
Key Features
Custom Types
- Enhances error detection at the compilation level.
- The
savemethod requires all essential fields to manage an entity effectively.
Partial Update Method
- Features a separate method for partial updates.
- Utilizes deep partial type as input, allowing for selective updates.
Soft Remove Functionality
- Provides
archiveandunarchivemethods. - Marks entities as deleted by setting the
deletedAttimestamp.
Transaction Support
- All methods are adorned with the
@Transactionaldecorator. - Default transaction propagation is set to REQUIRED.