Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend API to delete user account #1661

Open
spwoodcock opened this issue Jul 17, 2024 · 2 comments · May be fixed by #1848
Open

Backend API to delete user account #1661

spwoodcock opened this issue Jul 17, 2024 · 2 comments · May be fixed by #1848
Labels
backend Related to backend code effort:medium Likely a day or two enhancement New feature or request good first issue Good for newcomers priority:low Backlog of tasks that will be addressed in time

Comments

@spwoodcock
Copy link
Member

Is your feature request related to a problem? Please describe.

  • This is essential for GDPR.

Describe the solution you'd like

  • Deletion of a user db entry, in addition to keeping references to the user for task history in place.
  • How to keep the references in place? Save the username and profile picture in the task history?
@spwoodcock spwoodcock added backend Related to backend code effort:medium Likely a day or two enhancement New feature or request priority:low Backlog of tasks that will be addressed in time labels Jul 17, 2024
@spwoodcock spwoodcock added the good first issue Good for newcomers label Jul 18, 2024
@spwoodcock
Copy link
Member Author

@Sujanadh made some great points that in order to facilitate this we will need:

  • To remove the foreign key relation for task_events.user_id, from both the fmtm_schema.sql init SQL and via a migration.
  • To add the username and profile_img fields directly to the task_events table, in a migration and fmtm_schema.sql file again.
  • Update the models + SQL to no longer dynamically get the username / profile_img on read, but instead they should be inserted with the task event on write.

This way we can keep the task event record without actually having to link to an existing user.

However, we should first clarify if we need to keep this info, or if we should wipe it and simply show:
username: deleted
profile_img: a stock photo

@spwoodcock
Copy link
Member Author

spwoodcock commented Oct 29, 2024

Update to the above!

I don't think we should remove the user_id foreign key from task_events, as referential integrity is important and it allows us to easily join tables.

Instead we should update the foreign key to use ON DELETE RESTRICT, which means we can delete the user, but still keep rows that reference the user.

From the postgresql docs: RESTRICT prevents deletion of a referenced row. NO ACTION means that if any referencing rows still exist when the constraint is checked, an error is raised; this is the default behavior if you do not specify anything.

Please give this option a test 👍

@Anuj-Gupta4 Anuj-Gupta4 linked a pull request Nov 4, 2024 that will close this issue
1 task
Anuj-Gupta4 added a commit to Anuj-Gupta4/fmtm that referenced this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code effort:medium Likely a day or two enhancement New feature or request good first issue Good for newcomers priority:low Backlog of tasks that will be addressed in time
Projects
Development

Successfully merging a pull request may close this issue.

1 participant