Closed chriscarrollsmith closed 11 hours ago
Changed my mind and went with a flow where we actually delete the user record.
deleted
attributes from all database modelsdelete_user
endpointRolePermissionLink
and PasswordResetToken
errorsAdditionally, in this PR:
user.py
user.py
endpoints as well as a couple in main.py
client
fixture in the test suite with two separate fixtures, and authed_client
and an unauthed_client
get_authenticated_user
in utils/auth.py
so it uses a 303 rather than 307 HTTPException (because 303 changes POST requests to GET, whereas 307 redirects the original POST request to a different endpoint, which is not what we want for unauthorized POSTS)@AkanshuS, want to try your hand at code review? Good skill to know when applying for jobs!
The User model has a
deleted
column that we set to True if the user has deleted their account. So we need to make sure that in our auth endpoints and helper functions, we don't return deleted users (or allow deleted users to perform account actions). This approach is more complicated than actually deleting the user, but it has the following advantages:However, here's the part I don't love:
So, it's possible this is the wrong approach.