Ability to delete accounts#676
Conversation
|
@brianberlin Thanks for sending this PR and congrats on getting past draft! Could you rebase and squash out the intermediate work? I'm not sure what the conflict is. If you need assistance, let us know. |
jjcarstens
left a comment
There was a problem hiding this comment.
The soft delete functionality seems okay to me. But I might be a little loss on the Account removal. It seems like if we're removing an account, we'll also soft delete the org that user/account was a part of even if that org is still active with other users?
|
@brianberlin Do you have time to fix the tests this week? @jjcarstens and I are looking at merging the PR and it seems really close. We just want to make sure the tests pass and then do a quick pass on trying it out in staging. |
|
@fhunleth Sorry I haven't had much time to spare lately. I'll get it fixed up soon. |
|
@fhunleth I think all the tests should pass now. I still need to address @jjcarstens concerns. |
| |> Multi.delete_all(:deployments, &query_by_org_id(Deployment, &1)) | ||
| |> Multi.delete_all(:firmware_deltas, &query_firmware_deltas/1) | ||
| |> Multi.delete_all(:firmware_transfers, &query_by_org_id(FirmwareTransfer, &1)) | ||
| |> Multi.merge(&delete_firmwares/1) |
There was a problem hiding this comment.
This part of the multi could be an issue. It will make an s3 request for each firmware object that needs to be deleted. If it were to get halfway through and hit an error and roll back. That would cause the account to fail again and again. Thoughts on how to handle?
There was a problem hiding this comment.
It looks like oban is available. Maybe adding a job for each firmware in the Firmwares.delete_firmware/1 function?
|
@fhunleth I think this maybe ready. 🤞 |
jjcarstens
left a comment
There was a problem hiding this comment.
🎉 Thanks @brianberlin
This LGTM and really sorry for the delay. There has been quite a push on some other things that we've been behind on and are more immediately needed. Once those are in, we'll get this in as well to test around with.
connect #421
This pull request allows users to delete their accounts when they're done using NervesHub. When an account is deleted, most things can be "hard deleted". However, in order to handle orphaned devices that may become disruptive we elect to "soft delete". I've identified users, orgs, org_users, products, and devices to become soft deleted.