Skip to content

fix: add account deletion flow and audit trail#160

Merged
daviddprtma merged 4 commits into
daviddprtma:mainfrom
CodeByD3v:fix/107-account-deletion
Jun 23, 2026
Merged

fix: add account deletion flow and audit trail#160
daviddprtma merged 4 commits into
daviddprtma:mainfrom
CodeByD3v:fix/107-account-deletion

Conversation

@CodeByD3v

Copy link
Copy Markdown
Contributor

Summary

Implements the account deletion flow end-to-end by replacing the client-side soft delete with a backend-powered hard delete of the authenticated user, while preserving an audit trail.

What changed

  • Added DELETE /api/account backend route using the Supabase service-role client
  • Added account_deletion_log migration for a PII-free audit record
  • Updated the delete profile modal to:
    • call the backend first
    • disconnect the wallet if connected
    • sign the user out
    • redirect to /login
  • Added deleteAccount() to the frontend API helper
  • Updated the login page to display the "Account Deleted Successfully" message after redirect
  • Cleaned up backend account route logging for production

Notes

  • The backend route relies on the existing Supabase auth session token for authorization
  • The audit log stores only user_id and deleted_at
  • Existing database cascades handle related profile/batch cleanup

Testing

  • Verified the route wiring and client call flow in the codebase
  • Confirmed the migration file is in the expected Supabase migrations style

Closes #107

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@CodeByD3v is attempting to deploy a commit to the daviddprtma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@daviddprtma daviddprtma moved this from Todo to In Progress in AgroDex SSoC'26 Project Jun 23, 2026
@daviddprtma

Copy link
Copy Markdown
Owner

hello @CodeByD3v can you please resolve the merge conflicts first so I can see your work? thanks.

@CodeByD3v

Copy link
Copy Markdown
Contributor Author

Hey @daviddprtma, the conflicts have been resolved. Kindly review the PR and let me know if you have any suggestions. Thank you.

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agro-dex Ready Ready Preview, Comment Jun 23, 2026 4:18am
agro-dex-1u85 Ready Ready Preview, Comment Jun 23, 2026 4:18am

@daviddprtma daviddprtma merged commit f6aaa25 into daviddprtma:main Jun 23, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in AgroDex SSoC'26 Project Jun 23, 2026
@daviddprtma

Copy link
Copy Markdown
Owner

what an awesome job. thank you for contribute in AgroDex🎉. I hope you're successful in another project that you handle right now. all the best for you. don't forget to star this repo if you haven't do it yet👌

@CodeByD3v

Copy link
Copy Markdown
Contributor Author

Thank you so much, I really appreciate it. It was a pleasure contributing to AgroDex, and I’m glad the PR could help. Wishing you and the team all the best with the project as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

🐛: [BUG] Delete Profile can't be deleted for user

2 participants