Open joboy-dev opened 3 months ago
This endpoint allows an authenticated user to deactivate their account.
AUTHENTICATION
{ "Authorization": "Bearer <jwt_token>" }
HTTP METHOD AND URL
PATCH
/api/v1/accounts/deactivate
EMAIL
REQUEST BODY
The purpose of the user deactivation endpoint is to allow users to deactivate their accounts, enhancing user control and data privacy.
A user should be deactivated and should receive an email confirming that the account has been successfully deactivated.
[PATCH] /api/v1/accounts/deactivate
Request Body
{ "reason": "No longer need the account", "confirmation": true }
Response
{ "status_code": 200, "message": "Account Deactivated Successfully" }
Missing data
{ "reason": "No longer need the account", }
{ "status_code": 422, "error": "Invalid input", "detail": [ { "confirmation": "Deactivation confirmation is required" } ] }
Confirmation set to false
false
{ "reason": "No longer need the account", "confirmation": "false" }
{ "status_code": 400 , "error": "Confirmation needs to be true for deactivation" }
If the user has already been deactivated and they try to deactivate their account again.
{ "reason": "No longer need the account", "confirmation": "true" }
{ "status_code": 400 , "error": "User has been deactivated" }
Invalid or expired access token.
{ "status_code": 401, "error": "Could not validate user credentials" }
Unexpected error or server error
{ "status_code": 500, "error": "An unexpected error occured" }
Unit Test
End To End Test
This issue is linked to the approved issue here
Slack id: @joboy-dev
Description
This endpoint allows an authenticated user to deactivate their account.
Acceptance Criteria
AUTHENTICATION
HTTP METHOD AND URL
PATCH
requests./api/v1/accounts/deactivate
EMAIL
REQUEST BODY
Purpose
The purpose of the user deactivation endpoint is to allow users to deactivate their accounts, enhancing user control and data privacy.
Requirements
Expected Outcome
A user should be deactivated and should receive an email confirming that the account has been successfully deactivated.
Example
[PATCH]
/api/v1/accounts/deactivate
Success
Request Body
Response
Errors
Request Body
Missing data
Response
Request Body
Confirmation set to
false
Response
Request Body
If the user has already been deactivated and they try to deactivate their account again.
Response
Request Body
Invalid or expired access token.
Response
Request Body
Unexpected error or server error
Response
TEST
Unit Test
End To End Test