Spaces:
Sleeping
Sleeping
File size: 2,731 Bytes
4f01198 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | """
API URL Configuration
All routes prefixed with /api/ from the root urls.py
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework_simplejwt.views import TokenRefreshView
from api.views import (
LoginView, RegisterView, LogoutView, MeView, ChangePasswordView,
ServiceListView,
CaregiverViewSet,
PetViewSet,
BookingViewSet,
ConversationViewSet, MessageViewSet,
ImageUploadView,
DashboardStatsView,
)
router = DefaultRouter()
router.register(r'caregivers', CaregiverViewSet, basename='caregiver')
router.register(r'pets', PetViewSet, basename='pet')
router.register(r'bookings', BookingViewSet, basename='booking')
router.register(r'conversations', ConversationViewSet, basename='conversation')
router.register(
r'conversations/(?P<conversation_pk>[^/.]+)/messages',
MessageViewSet,
basename='message',
)
urlpatterns = [
# ββ Auth ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
path('auth/login/', LoginView.as_view(), name='auth-login'),
path('auth/register/', RegisterView.as_view(), name='auth-register'),
path('auth/logout/', LogoutView.as_view(), name='auth-logout'),
path('auth/refresh/', TokenRefreshView.as_view(), name='auth-refresh'),
path('auth/me/', MeView.as_view(), name='auth-me'),
path('auth/change-password/', ChangePasswordView.as_view(), name='auth-change-password'),
# ββ Services ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
path('services/', ServiceListView.as_view(), name='service-list'),
# ββ Image Upload ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
path('upload-image/', ImageUploadView.as_view(), name='image-upload'),
# ββ Admin Dashboard βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
path('admin/stats/', DashboardStatsView.as_view(), name='admin-stats'),
# ββ Viewset Routes ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
path('', include(router.urls)),
]
|