@aequum/crudl
v0.27.15
Published
aequum CRUD/CRUDL operations common components
Maintainers
Readme
aequum CRUD/CRUDL operations common components
A set of abstract class for application services having hexagonal architecture in mind to facilitate CRUD/CRUDL operations (Create, Read, Update, Delete, List).
Components
Services
BaseCRUDLService: Abstract class/interface for CRUDL methods, return types and some more.BaseCRUDLPaginatedService: Abstract class/interface extended fromBaseCRUDLServicewith a pagination method and return types.
Current implementations in the @aequum packages
- Mongoose abstract implementation of CRUDL with pagination service via
@aequum/mongooseon GitHub - TypeORM abstract implementation of CRUDL service via
@aequum/typeormon GitHub - Users NestJS Implementation in aequum boilerplate on GitHub
Example
Example for a simple CRUDL service:
import { BaseCRUDLService } from '@aequum/crudl';
import { UserRepository } from 'src/infrastructure/database/repositories/user.repository';
class UserService extends BaseCRUDLService<User> {
constructor(
protected repository: UserRepository,
) { }
}
const usersService = new UserService(
new UserRepository(),
);
await usersService.create({
name: 'John Doe',
email: '[email protected]',
password: 'password',
});
await userService.list();
