How much data would be deleting per user (on average)
How many users do you have (on average)
You don’t want to delete too many things at the same time.
Initial thoughts are that you can add the requency data to the user, then create a backend workflow that gets a User as a parameter. The workflow then can delete the data for the user based on the user’s specified frequency.
Schedule recurring workflows to run at intervals corresponding to the userDataRetentionFrequencies. A daily workflow that processes users with a “daily” setting. A weekly workflow for users with a “weekly” setting .. etc etc. Each would search for users with the corresponding frequency and trigger the deletion workflow for each.
The alternative would be to schedule the deletion upon the creation of the data. Too many WFs!
This is quite tricky to build @mehran even if you know Bubble well.
You need:
A workflow that selects all of the data in scope for deletion each time it is run, considering each user’s retention window, and then deletes it.
A process to trigger your delete workflow on a recurring basis, e.g. either a Recurring Event, or a recursive API Workflow (e.g. an API workflow that schedules itself the next day).
Also:
You need to consider how to monitor that it is working. Bubble’s logs can sometimes be difficult in this regard. Often we use a Process data type in this situation to track each time the process is run.
You also need to think about how your solution will work as it scales. It’s not really enough to say “Oh it’s fine, it works with 5 or 10 rows” if later there is the possibility of needing to handle much more data.