How to safely delete users and their data?

I have created an API workflow to delete unsubscribed users and their data.

  • First I delete data created by the user
  • Then I delete the user itself
  1. Do I need a pause in between the above steps, or some kind of dependency? Will there be a case where the second step completes before the first one does? (I’m suspecting there is due to some weird behavior)

  2. How do I ensure that deletion is done one user at a time, instead of for the entire User table? It’s possible that we may forget to check on the users we want to delete, and this may cause ALL data to be deleted accidentally (there is NO way to stop the operation!)

I just don’t feel very safe doing this. I’m now contemplating whether I should just mark the users as deleted, instead of deleting them. But this may cause bloat and also not sure about legal implications.