You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Develop an API endpoint that deactivates a user account. The endpoint should handle the deactivation process by marking the user's account as inactive or canceled, based on the provided reason.
Acceptance Criteria
The endpoint should be accessible via api/v1/users/deactivate and accept HTTP PATCH requests.
The request payload should include a confirmation field (boolean) and a reason field (string).
If confirmation is true, the account should be deactivated, and the reason should be recorded.
The API should validate the request and return appropriate responses based on the operation's success or failure.
Endpoint
URL
1. DEACTIVATE USER ACCOUNT
api/v1/users/deactivate
METHOD
PATCH
Request Body
{
"confirmation": true,
"reason": "No longer needed"
}
RESPONSE
Success Response (json)
{
"status": "success",
"message": "The account has been successfully deactivated.",
"data": {}
}
Error Response (json)
{
"status": "400",
"message": "Bad Request. The confirmation field is required.",
"data": {}
}
{
"status": "error",
"message": "Unauthorized. You do not have the necessary permissions.",
"data": {}
}
TASK
Implement the PATCH endpoint to handle user account deactivation.
Validate the input to ensure that confirmation is true and a reason is provided.
Integrate with the database to update the user status based on the deactivation request.
Ensure proper error handling and response codes for different scenarios (success, bad request, unauthorized).
Write unit tests to cover all possible cases, including successful deactivation, invalid request, and unauthorized access.
Write end-to-end tests to verify the entire deactivation process.
Expected Outcome
A functional API endpoint that can deactivate a user account based on the provided request payload.
The system should handle various scenarios, including success, bad request, and unauthorized access, with appropriate responses.
The text was updated successfully, but these errors were encountered:
Description
Develop an API endpoint that deactivates a user account. The endpoint should handle the deactivation process by marking the user's account as inactive or canceled, based on the provided reason.
Acceptance Criteria
api/v1/users/deactivate
and acceptHTTP PATCH
requests.Endpoint
URL
1. DEACTIVATE USER ACCOUNT
METHOD
Request Body
RESPONSE
Success Response (json)
Error Response (json)
TASK
Expected Outcome
The text was updated successfully, but these errors were encountered: