pub async fn delete_user(
__arg0: State<AppState>,
__arg1: Path<i64>,
__arg2: Extension<AuthUser>,
) -> impl IntoResponse
Expand description
DELETE /users/{user_id}
Delete a user by their ID. Only admins can access this endpoint. Users cannot delete their own account.
§Path Parameters
id
- The ID of the user to delete
§Responses
200 OK
{
"success": true,
"message": "User deleted successfully"
}
404 Not Found
{
"success": false,
"message": "User not found"
}
400 Bad Request
(invalid ID format)
{
"success": false,
"message": "Invalid user ID format"
}
403 Forbidden
{
"success": false,
"message": "You cannot delete your own account"
}
500 Internal Server Error
{
"success": false,
"message": "Database error: detailed error here"
}