{"id":16464849,"url":"https://github.com/christophecvb/strapi-plugin-soft-delete","last_synced_at":"2025-03-21T06:31:57.274Z","repository":{"id":149295301,"uuid":"592528168","full_name":"ChristopheCVB/strapi-plugin-soft-delete","owner":"ChristopheCVB","description":"Powerful Strapi based Soft Delete feature, never loose content again","archived":false,"fork":false,"pushed_at":"2024-03-14T17:58:06.000Z","size":295,"stargazers_count":15,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T05:45:39.967Z","etag":null,"topics":["plugin","soft-delete","strapi","strapi4"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"quiloos39/strapi-soft-delete","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristopheCVB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=K5NSGWHK3RDP6\u0026item_name=Strapi+Plugin+Soft+Delete\u0026currency_code=EUR\u0026source=url"]}},"created_at":"2023-01-23T23:10:02.000Z","updated_at":"2025-01-10T15:46:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4bf7bf99-a81f-40c6-beb3-a767d9162b2d","html_url":"https://github.com/ChristopheCVB/strapi-plugin-soft-delete","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopheCVB%2Fstrapi-plugin-soft-delete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopheCVB%2Fstrapi-plugin-soft-delete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopheCVB%2Fstrapi-plugin-soft-delete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopheCVB%2Fstrapi-plugin-soft-delete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristopheCVB","download_url":"https://codeload.github.com/ChristopheCVB/strapi-plugin-soft-delete/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244751274,"owners_count":20504238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","soft-delete","strapi","strapi4"],"created_at":"2024-10-11T11:30:03.690Z","updated_at":"2025-03-21T06:31:56.818Z","avatar_url":"https://github.com/ChristopheCVB.png","language":"TypeScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=K5NSGWHK3RDP6\u0026item_name=Strapi+Plugin+Soft+Delete\u0026currency_code=EUR\u0026source=url"],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\" width=\"150px\"\u003e\n  \u003cimg style=\"width: 150px; height: auto;\" src=\"public/assets/logo.png\" alt=\"Logo - Strapi Soft Delete plugin\" /\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eStrapi v4 - Soft Delete plugin\u003c/h1\u003e\n  \u003cp\u003ePowerful Strapi based Soft Delete feature, never loose content again\u003c/p\u003e\n  \u003ca href=\"https://www.npmjs.org/package/strapi-plugin-soft-delete\"\u003e\n    \u003cimg alt=\"GitHub package.json version\" src=\"https://img.shields.io/github/package-json/v/ChristopheCVB/strapi-plugin-soft-delete?label=npm\u0026logo=npm\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.org/package/strapi-plugin-soft-delete\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/strapi-plugin-soft-delete.svg\" alt=\"Monthly download on NPM\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/assets/preview.png\" alt=\"UI preview\" /\u003e\n\u003c/div\u003e\n\nA plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides a Soft Delete feature.\n\n## ✨ Features\n\n- 🛢 Database\n  - Adds `_softDeletedAt`, `_softDeletedById` and `_softDeletedByType` fields to all your collection and single content types. Those fields are not visible in the Content Manager nor through the API.\n- 🗂️ Content Manager \u0026 API\n  - The delete from the Content Manager \u0026 API behaves as a soft delete. It will set `_softDeletedAt` to the current datetime, `_softDeletedById` to the action initiator id that deleted it and `_softDeletedByType` to the type of the delete action initiator.\n- 👤 RBAC\n  - The `Delete` is renamed to `Soft Delete` and it is located in the `Settings \u003e Roles \u003e Edit a Role \u003e Collection Types | Single Types` section.\n  - A new admin permission is added to the `Settings \u003e Roles \u003e Edit a Role \u003e Collection Types | Single Types` section. This is the `Deleted Read` permission. This will allow the admin role to view the soft deleted entries.\n  - A new admin permission is added to the `Settings \u003e Roles \u003e Edit a Role \u003e Collection Types | Single Types` section. This is the `Deleted Restore` permission. This will allow the admin role to restore the soft deleted entries.\n  - A new admin permission is added to the `Settings \u003e Roles \u003e Edit a Role \u003e Collection Types | Single Types` section. This is the `Delete Permanently` permission. This will allow the admin role to delete permanently the soft deleted entries.\n  - A new admin permission is added to the `Settings \u003e Roles \u003e Edit a Role \u003e Plugins \u003e Soft Delete` section. This is the global `Read` permission of the plugin. This will allow the admin role to view the Soft Delete item in the Admin left Panel. Accessing this will list all the content types the admin role has access to. They can restore or delete permanently the entries from here depending on the above permissions.\n  - A new admin permission is added to the `Settings \u003e Roles \u003e Edit a Role \u003e Plugins \u003e Soft Delete` section. This is the global `Settings` permission of the plugin. This will allow the admin role to view the Soft Delete plugin settings.\n- 🗂️ Soft Delete Explorer (Admin left Panel item): Displays Soft Deleted Collection \u0026 Single Type entries \n  - ♻️ Entries can be restored with the `Restore` action. This will set the fields `_softDeletedAt`, `_softDeletedById` and `_softDeletedByType` to `null`.\n  - 🗑️ Entries can be permanently deleted with the `Delete Permanently` action. This will delete the entry permanently from the databse.\n- ⚙️ Settings\n  - Restoration Behavior: This setting allows you to choose the behavior when restoring an entry.\n    - Single Type\n      - Soft Delete: Restoring a Single Type entry will restore it to the Content Manager explorer and Soft Delete the existing entry.\n      - Delete Permanently: Restoring a Single Type entry will restore it to the Content Manager explorer and Delete Permanently the existing entry.\n    - Draft \u0026 Publish\n      - Draft: Restoring a Draft \u0026 Publish entry will restore it to the Content Manager explorer as a draft.\n      - Unchanged: Restoring a Draft \u0026 Publish entry will restore it to the Content Manager explorer unchanged, meaning that if the entry was published, it will be restored as published.\n\n## ⛔ Permissions\n\n| Section | Permission | Description |\n| ---------- | ---------- | ----------- |\n| Collection \u0026 Single Types | `Deleted Restore` | Allows the admin role to restore the soft deleted entries. |\n| Collection \u0026 Single Types | `Deleted Read` | Allows the admin role to view the soft deleted entries. |\n| Collection \u0026 Single Types | `Delete Permanently` | Allows the admin role to delete permanently the soft deleted entries. |\n| Plugins | `Read` | Allows the admin role to view the Soft Delete item in the Admin left Panel. |\n| Plugins | `Settings` | Allows the admin role to view the Soft Delete plugin settings. |\n\n## 📦 Compatibility\n\n| Strapi Version | Plugin Version |\n| -------------- | -------------- |\n| ^4.11          | 1.0.0          | \u003c!-- FIXME: From which Strapi v4 does the plugin work --\u003e\n| ^3             | Not Supported  |\n\n\u003e This plugin is designed for **Strapi v4** and will not work with v3.x.\n\n## 🚨 Caveats\n\nBecause of the way the plugin handles soft deleted entries, there are some caveats to be aware of:\n- Lifecycle hooks:\n  - `beforeDelete`, `afterDelete`, `beforeDeleteMany` and `afterDeleteMany` lifecycle hooks are not triggered when soft deleting entries. Instead, the `beforeUpdate`, `afterUpdate`, `beforeUpdateMany` and `afterUpdateMany` are. \u003c!-- Instead, the new `beforeSoftDelete`, `afterSoftDelete`, `beforeSoftDeleteMany` and `afterSoftDeleteMany` lifecycle hooks are triggered. --\u003e\u003c!-- TODO: Is it possible to create custom lifecyle hooks? Maybe by wrapping https://github.com/strapi/strapi/blob/40b3acfe6f9bb9ff73dfba951090731879b87ec5/packages/core/strapi/lib/services/event-hub.js#L22 --\u003e\n  - `beforeDelete`, `afterDelete`, `beforeDeleteMany` and `afterDeleteMany` lifecycle hooks are triggered when permanently deleting entries.\n\n## ⏳ Installation\n\nTo install this plugin, you need to add an NPM dependency to your Strapi application:\n\n```sh\n# Using Yarn\nyarn add strapi-plugin-soft-delete\n\n# Or using PNPM\npnpm add strapi-plugin-soft-delete\n\n# Or using NPM\nnpm install strapi-plugin-soft-delete\n```\n\nEdit your `config/plugins.js|ts` or `config/\u003cenv\u003e/plugins.js|ts` file and add the following configuration:\n\n```js\n// ...\n  \"soft-delete\": {\n    enabled: true,\n  },\n// ...\n```\n\nThen, you'll need to build your admin panel:\n\n```sh\n# Using Yarn\nyarn build\n\n# Or using PNPM\npnpm run build\n\n# Or using NPM\nnpm run build\n```\n\nFinally, start your application:\n\n```sh\n# Using Yarn\nyarn develop\n\n# Or using PNPM\npnpm run develop\n\n# Or using NPM\nnpm run develop\n```\n\n## 🤝 Contributing\n\nFeel free to fork and make a PR if you want to add something or fix a bug.\n\n## 🛣️ Roadmap\n\n- 🖧 Server\n  - [x] `_softDeletedAt` field on API Content Types\n  - [x] `_softDeletedById` field on API Content Types\n  - [x] `_softDeletedByType` field on API Content Types\n  - [x] Decorate Content Type Entity Services to handle `_softDeleted*` fields when deleting an entry upon `delete` or `deleteMany` methods\n  - [x] Decorate Content Type Entity Services to hide entries upon `find` or `findMany` methods\n  - [x] RBAC Permissions\n  - [x] Admin Routes\n  - [x] Single Type entry restore special case\n  - [x] Draft \u0026 Publish support when restoring an entry\n  - [x] Audit Logs support\n  - [ ] Custom Lifecycle Hooks\n  - [ ] Handle Soft Deleting Components\n  - [ ] Add tests\n- 🗂️ Soft Delete Explorer\n  - [x] Content Types list\n  - [x] Entries list\n    - [ ] Pagination\n    - [ ] Filters\n  - [x] Restore action\n  - [x] Delete Permanently action\n  - [x] Translation\n  - [ ] Soft Deleted Entry details\n- ⚙️ Plugin Settings\n  - [x] Restoration Behavior\n    - [x] Single Type\n    - [x] Draft \u0026 Publish\n  - [ ] Deletion Automation\n\n## 🚮 Uninstall\n\nTo uninstall this plugin, you need to remove the NPM dependency from your Strapi application:\n\n```sh\n# Using Yarn\nyarn remove strapi-plugin-soft-delete\n\n# Or using PNPM\npnpm remove strapi-plugin-soft-delete\n\n# Or using NPM\nnpm uninstall strapi-plugin-soft-delete\n```\n\nEdit your `config/plugins.js|ts` or `config/\u003cenv\u003e/plugins.js|ts` file and remove the following configuration:\n\n```js\n// ...\n  \"soft-delete\": {\n    enabled: true,\n  },\n// ...\n```\n\nAlso, _**if you have edited your API Content Types through the Content Builder**_, and because the plugin adds fields to it, you'll need to remove them from the schemas manually. The fields are:\n- `_softDeletedAt`\n- `_softDeletedById`\n- `_softDeletedByType`\n\nThen, you'll need to build your admin panel:\n\n```sh\n# Using Yarn\nyarn build\n\n# Or using PNPM\npnpm run build\n\n# Or using NPM\nnpm run build\n```\n\nFinally, start your application:\n\n```sh\n# Using Yarn\nyarn develop\n\n# Or using PNPM\npnpm run develop\n\n# Or using NPM\nnpm run develop\n```\n\n## 👨‍💻 Community support\n\nFor general help using Strapi, please refer to [the official Strapi documentation](https://docs.strapi.io/). For additional help, you can use one of these channels to ask a question:\n\n- [Discord](https://discord.strapi.io/) I'm present on official Strapi Discord workspace. Find me by `ChristopheCVB`.\n- [GitHub](https://github.com/ChristopheCVB/strapi-plugin-soft-delete/issues) (Bug reports, Contributions, Questions and Discussions)\n\n## 📝 License\n\n[MIT License](LICENSE.md) Copyright (c) [ChristopheCVB](https://www.christophecvb.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophecvb%2Fstrapi-plugin-soft-delete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophecvb%2Fstrapi-plugin-soft-delete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophecvb%2Fstrapi-plugin-soft-delete/lists"}