[Answered ]-Storing data before committing to data base, wait for approval of admin

2đź‘Ť

If this were my project, I’d save all changes to the same database table but I’d mark a field called “WaitingForApproval” as True. Then you can create a page for admins showing all the items waiting to be approved and they can either approve or deny them.

When denied, you can either delete that record or mark a field called “Deleted” as true and make sure not to ever show that record unless somebody specifically wants to see deleted records.

Anytime you pull data from the database, you’ll want to filter based on WaitingForApproval being true or false (usually false, unless it’s specifically for the admin approval page). This way, you can keep pending changes in the same table without cluttering up the rest of the application.

Or if you already have a lot of queries written in the app that you don’t want to change, you can just save these pending changes into a different but identical database table. When an admin approves it, your back-end code will just copy the data from the PendingChanges table to the Main table.

👤Dr. Cool

Leave a comment