{"id":26825166,"url":"https://github.com/chancehudson/loopback-archive-mixin","last_synced_at":"2025-03-30T10:19:24.516Z","repository":{"id":77470600,"uuid":"87246880","full_name":"chancehudson/loopback-archive-mixin","owner":"chancehudson","description":"A mixin to archive models instead of delete them","archived":false,"fork":false,"pushed_at":"2017-04-07T19:57:03.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-21T00:41:15.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chancehudson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2017-04-05T00:06:38.000Z","updated_at":"2024-07-21T00:41:22.050Z","dependencies_parsed_at":"2023-03-09T08:00:23.015Z","dependency_job_id":null,"html_url":"https://github.com/chancehudson/loopback-archive-mixin","commit_stats":null,"previous_names":["chancehudson/loopback-archive-mixin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Floopback-archive-mixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Floopback-archive-mixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Floopback-archive-mixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Floopback-archive-mixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chancehudson","download_url":"https://codeload.github.com/chancehudson/loopback-archive-mixin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246302342,"owners_count":20755574,"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":[],"created_at":"2025-03-30T10:19:24.022Z","updated_at":"2025-03-30T10:19:24.507Z","avatar_url":"https://github.com/chancehudson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Archive\n=============\n\nThis module is designed for the [Strongloop Loopback](https://github.com/strongloop/loopback) framework. It allows entities of any Model to be archived by adding `deletedAt` and `isDeleted` attributes. Queries following the standard format will not return these entities; they can only be accessed by adding `{ deleted: true }` to the query object (at the same level as `where`, `include` etc).\n\nBy default `count` and `update` operations will only apply to models that are not deleted. This is overridden by specifying a defined value for either `deletedAt` or `isDeleted`.\n\nThis is heavily based on the [loopback-softdelete-mixin](https://github.com/gausie/loopback-softdelete-mixin) by [Samuel Gauss](https://github.com/gausie). (Thanks!)\n\nInstall\n-------\n\n```bash\n  npm install --save loopback-archive-mixin\n```\n\nConfigure\n----------\n\nTo use with your Models add the `mixins` attribute to the definition object of your model config.\n\n```json\n  {\n    \"name\": \"Message\",\n    \"properties\": {\n      \"name\": {\n        \"type\": \"string\",\n      },\n    },\n    \"mixins\": {\n      \"Archive\" : {}\n    },\n  },\n```\n\nThis is a minimal mixin, the only customization is the property names assigned for indicating deletion. The default properties are `deletedAt` and `isDeleted`.\n\n```json\n  \"mixins\": {\n    \"Archive\": {\n      \"deletedAt\": \"deletedAt\",\n      \"isDeleted\": \"isDeleted\"\n    },\n  },\n```\n\nRetrieving deleted entities\n---------------------------\n\nTo run queries that include deleted items in the response, add `{ deleted: true }` to the query object (at the same level as `where`, `include` etc).\n\nBy default count and update queries will only operate on models that have not been deleted. Specifying either `deletedAt` or `isDeleted` in the matching clause will run the query like normal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchancehudson%2Floopback-archive-mixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchancehudson%2Floopback-archive-mixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchancehudson%2Floopback-archive-mixin/lists"}