ilorm-plugin-softdelete
v0.1.2
Published
Plugin to handle soft delete with ilorm
Downloads
5
Readme
ilorm-plugin-softDelete
## Soft delete When soft delete is enable. All remove / removeOne order are converted in update a flag "isDeleted" to true. After, all the query targeting the database have a default query ; isDeleted = false.
## Use the plugin
The plugin add forceRemove
and forceRemoveOne
to handle the hard delete.
const ilorm = require('ilorm');
const ilormSoftDelete = require('ilorm-soft-delete');
ilorm.use(ilormSoftDelete());
// Now model have ;
User.query()
.removeOne(); // Soft delete (update the flag)
User.query()
.forceRemoveOne(); // Hard delete (real delete).