Add documentation for delete_user and reset_user_password endpoints. Update update_profile to reflect consolidated endpoint. Remove obsolete documentation for individual update operations. Add profile guide for end-users. Update API_CONSOLIDATION_PLAN.md with implementation status.
47 lines
1.0 KiB
Markdown
47 lines
1.0 KiB
Markdown
# Delete User
|
|
|
|
Delete a user account. Supports both self-deletion and admin deletion.
|
|
|
|
**Endpoints**:
|
|
- Self-deletion: `DELETE /api/auth/profile`
|
|
- Admin deletion: `DELETE /api/auth/profile/:id`
|
|
|
|
**Auth**: Required
|
|
|
|
## Self-Deletion
|
|
|
|
Users can delete their own account. This permanently removes the user and all associated data.
|
|
|
|
**Endpoint**: `DELETE /api/auth/profile`
|
|
|
|
## Admin Deletion
|
|
|
|
Admins can delete any user account by providing the user ID in the URL.
|
|
|
|
**URL Parameter**: `:id` - Target user's UUID
|
|
|
|
**Endpoint**: `DELETE /api/auth/profile/:id`
|
|
|
|
## Response (200 OK)
|
|
|
|
```json
|
|
{
|
|
"message": "account deleted"
|
|
}
|
|
```
|
|
|
|
## Error Responses
|
|
|
|
| Code | Description |
|
|
|------|-------------|
|
|
| 400 | Cannot delete the last admin |
|
|
| 401 | Invalid or expired token |
|
|
| 403 | Admin access required (trying to delete another user) |
|
|
| 404 | User not found (admin mode only) |
|
|
|
|
## Safety Rules
|
|
|
|
- The last remaining admin cannot be deleted
|
|
- Self-deletion requires the user to not be the last admin
|
|
- Admin deletion is restricted to admin role only
|