Skip to content

Commit

Permalink
feat(sequelize): add sequelize repository support
Browse files Browse the repository at this point in the history
Export `SequelizeSoftCrudRepository` providing soft-delete capabilities with sequelize as underlying
repository

GH-118
  • Loading branch information
shubhamp-sf committed Feb 28, 2023
1 parent aa622ab commit 614b485
Show file tree
Hide file tree
Showing 8 changed files with 3,201 additions and 12,666 deletions.
1 change: 1 addition & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
{name: 'ci-cd'},
{name: 'repository'},
{name: 'entity'},
{name: 'sequelize'},
],

appendBranchNameToCommitMessage: false,
Expand Down
6 changes: 3 additions & 3 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Path to sources
sonar.sources=src

# ignoring transaction repository as the duplication of the code is
# a compulsion in it, It's currently deprecated and will be completely removed in future releases.
sonar.exclusions=src/__tests__/**,src/repositories/default-transaction-soft-crud.repository.base.ts
# Ignoring transaction and sequelize soft crud repository as the duplication of the code is a compulsion in it.
# These will be removed in a next major release in favor of universal mixin usage.
sonar.exclusions=src/__tests__/**,src/repositories/default-transaction-soft-crud.repository.base.ts,src/repositories/sequelize.soft-crud.repository.base.ts
#sonar.inclusions=

# Path to tests
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The package exports following classes and mixins:
3. [SoftCrudRepositoryMixin](#softcrudrepositorymixin) - Mixin accepting any respository that extends the DefaultCrudRepository to add soft delete functionality to. Can be used as a wrapper for `DefaultCrudRepository`, `DefaultTransactionalRepository` etc.
4. [SoftDeleteEntityMixin](#softdeleteentitymixin)
5. [DefaultTransactionSoftCrudRepository](#defaulttransactionsoftcrudrepository-deprecated) (Deprecated) - Class providing soft crud capabilitiies. To be used in place of `DefaultTransactionalRepository`.
6. [SequelizeSoftCrudRepository](#sequelizesoftcrudrepository) - Class providing soft crud capabilitiies for [loopback4-sequelize](https://www.npmjs.com/package/loopback4-sequelize) package. To be used in place of `SequelizeCrudRepository`.

Following are more details on the usage of above artifcats:

Expand All @@ -42,6 +43,11 @@ The column names needed to be there in DB within that table are - 'deleted', 'de
If you are using auto-migration of loopback 4, then, you may not need to do anything specific to add this column.
If not, then please add these columns to the DB table.

### SequelizeSoftCrudRepository

An abstract base class providing soft delete capabilities for projects using [loopback4-sequelize](https://www.npmjs.com/package/loopback4-sequelize) package.
All the other workings are similar to [SoftCrudRepository](#softcrudrepository).

### SoftCrudRepository

An abstract base class for all repositories which require soft delete feature.
Expand Down
Loading

0 comments on commit 614b485

Please sign in to comment.