@vuex-orm/plugin-soft-delete
v1.2.1
Published
Vuex ORM plugin for adding soft delete capability.
Downloads
284
Readme
Vuex ORM Soft Delete plugin adds soft delete capabilities to Vuex ORM models.
The plugin allows models to be soft deleted or "trashed" without actually removing them from the entity data set. Subsequently, when executing queries, the soft deleted models will be excluded from results. Using query modifiers, queries can be instructed to inclusively or exclusively retrieve soft deletes.
// Model action example...
User.softDelete(1)
// Instance action example...
const user = User.find(1)
await user.$softDelete()
// Query integration example...
User.query().withTrashed().get()
User.query().onlyTrashed().get()
Documentation
You can check out the full documentation for Vuex ORM Plugin: Soft Delete at https://vuex-orm.github.io/plugin-soft-delete.
Questions & Discussions
Join us on our Slack Channel for any questions and discussions.
Although there is the Slack Channel, do not hesitate to open an issue for any question you might have. We're always more than happy to hear any feedback, and we don't care what kind of form they are.
Quick Start
Here's a quick start guide to demonstrate how the Soft Delete plugin can be integrated effortlessly.
Install the plugin
Install the plugin with npm or Yarn. Ensure the latest version of Vuex ORM is installed.
npm install @vuex-orm/core @vuex-orm/plugin-soft-delete
# OR
yarn add @vuex-orm/core @vuex-orm/plugin-soft-delete
Register the plugin
Register the plugin using the VuexORM.use
method. Furthermore, you may configure the plugin with options.
import VuexORM from '@vuex-orm/core'
import VuexORMSoftDelete from '@vuex-orm/plugin-soft-delete'
VuexORM.use(VuexORMSoftDelete)
Plugins
Vuex ORM can be extended via plugins to add additional features. Here is a list of available plugins.
- Vuex ORM Axios – The plugin to sync the store against a RESTful API.
- Vuex ORM GraphQL – The plugin to sync the store against a GraphQL API.
- Vuex ORM Search – The plugin adds a search() method to filter records using fuzzy search logic from the Fuse.js.
- Vuex ORM Change Flags - Vuex ORM plugin for adding IsDirty / IsNew flags to model entities.
Contribution
We are excited that you are interested in contributing to Vuex ORM Soft Delete! Anything from raising an issue, submitting an idea of a new feature, or making a pull request is welcome!
Development
yarn build
Compile files and generate bundles in dist
directory.
yarn lint
Lint files using a rule of Standard JS.
yarn test
Run the test using Jest.
yarn test:watch
Run the test in watch mode.
yarn coverage
Generate test coverage in coverage
directory.
License
Vuex ORM Soft Delete is open-sourced software licensed under the MIT license.