{"action":"created","issue":{"url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/133","repository_url":"https://api.github.com/repos/JKHeadley/rest-hapi","labels_url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/133/comments","events_url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/133/events","html_url":"https://github.com/JKHeadley/rest-hapi/issues/133","id":336574617,"node_id":"MDU6SXNzdWUzMzY1NzQ2MTc=","number":133,"title":"Recover soft-deleted items","user":{"login":"SukantGujar","id":6153264,"node_id":"MDQ6VXNlcjYxNTMyNjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6153264?v=4","gravatar_id":"","url":"https://api.github.com/users/SukantGujar","html_url":"https://github.com/SukantGujar","followers_url":"https://api.github.com/users/SukantGujar/followers","following_url":"https://api.github.com/users/SukantGujar/following{/other_user}","gists_url":"https://api.github.com/users/SukantGujar/gists{/gist_id}","starred_url":"https://api.github.com/users/SukantGujar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SukantGujar/subscriptions","organizations_url":"https://api.github.com/users/SukantGujar/orgs","repos_url":"https://api.github.com/users/SukantGujar/repos","events_url":"https://api.github.com/users/SukantGujar/events{/privacy}","received_events_url":"https://api.github.com/users/SukantGujar/received_events","type":"User","site_admin":false},"labels":[{"id":471495960,"node_id":"MDU6TGFiZWw0NzE0OTU5NjA=","url":"https://api.github.com/repos/JKHeadley/rest-hapi/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":978493912,"node_id":"MDU6TGFiZWw5Nzg0OTM5MTI=","url":"https://api.github.com/repos/JKHeadley/rest-hapi/labels/good%20first%20issue","name":"good first issue","color":"abfcf9","default":true},{"id":471495961,"node_id":"MDU6TGFiZWw0NzE0OTU5NjE=","url":"https://api.github.com/repos/JKHeadley/rest-hapi/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/JKHeadley/rest-hapi/milestones/12","html_url":"https://github.com/JKHeadley/rest-hapi/milestone/12","labels_url":"https://api.github.com/repos/JKHeadley/rest-hapi/milestones/12/labels","id":3460139,"node_id":"MDk6TWlsZXN0b25lMzQ2MDEzOQ==","number":12,"title":"Recover Soft Delete","description":null,"creator":{"login":"JKHeadley","id":12631935,"node_id":"MDQ6VXNlcjEyNjMxOTM1","avatar_url":"https://avatars3.githubusercontent.com/u/12631935?v=4","gravatar_id":"","url":"https://api.github.com/users/JKHeadley","html_url":"https://github.com/JKHeadley","followers_url":"https://api.github.com/users/JKHeadley/followers","following_url":"https://api.github.com/users/JKHeadley/following{/other_user}","gists_url":"https://api.github.com/users/JKHeadley/gists{/gist_id}","starred_url":"https://api.github.com/users/JKHeadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JKHeadley/subscriptions","organizations_url":"https://api.github.com/users/JKHeadley/orgs","repos_url":"https://api.github.com/users/JKHeadley/repos","events_url":"https://api.github.com/users/JKHeadley/events{/privacy}","received_events_url":"https://api.github.com/users/JKHeadley/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2018-06-28T16:12:36Z","updated_at":"2018-06-28T16:12:36Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2018-06-28T11:03:47Z","updated_at":"2018-07-03T06:58:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**Is your feature request related to a problem? Please describe.**\r\nAside from serving as an archival process, soft-deletion also helps perform a recovery of the deleted data. Would an update query work on soft-deleted items to remove the deleted flag? Or would it require a MongoDB update?\r\n\r\n**Describe the solution you'd like**\r\nThe update method can accept a flag to include soft-deleted items. This should allow their recovery.\r\n"},"comment":{"url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/comments/402033292","html_url":"https://github.com/JKHeadley/rest-hapi/issues/133#issuecomment-402033292","issue_url":"https://api.github.com/repos/JKHeadley/rest-hapi/issues/133","id":402033292,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjAzMzI5Mg==","user":{"login":"SukantGujar","id":6153264,"node_id":"MDQ6VXNlcjYxNTMyNjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6153264?v=4","gravatar_id":"","url":"https://api.github.com/users/SukantGujar","html_url":"https://github.com/SukantGujar","followers_url":"https://api.github.com/users/SukantGujar/followers","following_url":"https://api.github.com/users/SukantGujar/following{/other_user}","gists_url":"https://api.github.com/users/SukantGujar/gists{/gist_id}","starred_url":"https://api.github.com/users/SukantGujar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SukantGujar/subscriptions","organizations_url":"https://api.github.com/users/SukantGujar/orgs","repos_url":"https://api.github.com/users/SukantGujar/repos","events_url":"https://api.github.com/users/SukantGujar/events{/privacy}","received_events_url":"https://api.github.com/users/SukantGujar/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T06:58:33Z","updated_at":"2018-07-03T06:58:33Z","author_association":"CONTRIBUTOR","body":"I am trying to implement this. This is the first time I am working on anything Hapi, so going really slow :). Couple of things:\r\n\r\n1. Introduced two new config options: `enableRecoveryOfSoftDeletedItems` and `softDeletedRecoveryEndpoint`. The first one controls whether recovery endpoints are available and the second option controls the name of this endpoint, defaults to `recover` (POST /{modelname}/{_id}/recover). Sounds ok? This is different from what you suggested above.\r\n2. While going through `rest-helper-factory` which contains the various API setup, noticed that the Auth scopes are also setup there. In this case, although the verb is `POST`, it makes sense to consider the same scope as `DELETE` for recovery also, considering a person who deleted would need to recover. This is simpler than introducing a new scope for recovery.\r\n3. Will be adding a new method to the same file `generateRecoverOneEndpoint` and any supportive methods based on the `generateDeleteOneEndpoint` implementation.\r\n4. Noticed that there's model validation code even for methods working on just the `id` of the resource (find and deleteone). Is this necessary?\r\n5. Any other suggestions?"}}
{"actor":{"display_login":"SukantGujar"}}