From ab06bc4fc9289df102e4e44bebe33e6b33438181 Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Fri, 26 Dec 2025 17:26:50 -0700 Subject: [PATCH] Add API root endpoint for /api/users/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added UsersAPIRoot view that returns available user-related endpoints when accessing /api/users/ directly. All API endpoint groups now have discoverable root endpoints: - /api/ - Main API root - /api/users/ - User endpoints - /api/tasks/ - Task endpoints (already had TaskListCreateAPIView) - /api/sync/ - Sync endpoints (already had sync view) - /api/notifications/ - Notification endpoints (already had NotificationListAPIView) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- users/urls.py | 1 + users/views.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/users/urls.py b/users/urls.py index c42b227..a79f207 100644 --- a/users/urls.py +++ b/users/urls.py @@ -9,6 +9,7 @@ from . import views # API URLs (to be included under /api/users/) api_urlpatterns = [ + path('', views.UsersAPIRoot.as_view(), name='api-users-root'), path('register/', views.RegisterAPIView.as_view(), name='api-register'), path('verify-email/', views.VerifyEmailAPIView.as_view(), name='api-verify-email'), path('resend-verification/', views.ResendVerificationEmailAPIView.as_view(), name='api-resend-verification'), diff --git a/users/views.py b/users/views.py index 9164260..b5fa1c6 100644 --- a/users/views.py +++ b/users/views.py @@ -31,6 +31,25 @@ User = get_user_model() # API Views # ============================================================================= +class UsersAPIRoot(APIView): + """API root for users endpoints.""" + permission_classes = [permissions.AllowAny] + + def get(self, request): + return Response({ + 'endpoints': { + 'register': '/api/users/register/', + 'login': '/api/users/token/', + 'refresh_token': '/api/users/token/refresh/', + 'verify_email': '/api/users/verify-email/', + 'resend_verification': '/api/users/resend-verification/', + 'profile': '/api/users/profile/', + 'change_password': '/api/users/change-password/', + 'devices': '/api/users/devices/', + } + }) + + class RegisterAPIView(generics.CreateAPIView): """API endpoint for user registration."""