mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 05:31:09 -05:00
feat: major API restructure and Vue.js frontend integration
- Centralize API endpoints in dedicated api app with v1 versioning - Remove individual API modules from parks and rides apps - Add event tracking system with analytics functionality - Integrate Vue.js frontend with Tailwind CSS v4 and TypeScript - Add comprehensive database migrations for event tracking - Implement user authentication and social provider setup - Add API schema documentation and serializers - Configure development environment with shared scripts - Update project structure for monorepo with frontend/backend separation
This commit is contained in:
142
backend/apps/api/v1/urls.py
Normal file
142
backend/apps/api/v1/urls.py
Normal file
@@ -0,0 +1,142 @@
|
||||
"""
|
||||
URL configuration for ThrillWiki API v1.
|
||||
|
||||
This module provides unified API routing following RESTful conventions
|
||||
and DRF Router patterns for automatic URL generation.
|
||||
"""
|
||||
|
||||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from drf_spectacular.views import (
|
||||
SpectacularAPIView,
|
||||
SpectacularSwaggerView,
|
||||
SpectacularRedocView,
|
||||
)
|
||||
|
||||
from .viewsets import (
|
||||
ParkViewSet,
|
||||
RideViewSet,
|
||||
ParkReadOnlyViewSet,
|
||||
RideReadOnlyViewSet,
|
||||
LoginAPIView,
|
||||
SignupAPIView,
|
||||
LogoutAPIView,
|
||||
CurrentUserAPIView,
|
||||
PasswordResetAPIView,
|
||||
PasswordChangeAPIView,
|
||||
SocialProvidersAPIView,
|
||||
AuthStatusAPIView,
|
||||
HealthCheckAPIView,
|
||||
PerformanceMetricsAPIView,
|
||||
SimpleHealthAPIView,
|
||||
# History viewsets
|
||||
ParkHistoryViewSet,
|
||||
RideHistoryViewSet,
|
||||
UnifiedHistoryViewSet,
|
||||
# New comprehensive viewsets
|
||||
ParkAreaViewSet,
|
||||
ParkLocationViewSet,
|
||||
CompanyViewSet,
|
||||
RideModelViewSet,
|
||||
RollerCoasterStatsViewSet,
|
||||
RideLocationViewSet,
|
||||
RideReviewViewSet,
|
||||
UserProfileViewSet,
|
||||
TopListViewSet,
|
||||
TopListItemViewSet,
|
||||
)
|
||||
|
||||
# Create the main API router
|
||||
router = DefaultRouter()
|
||||
|
||||
# Register ViewSets with descriptive prefixes
|
||||
|
||||
# Core models
|
||||
router.register(r"parks", ParkViewSet, basename="park")
|
||||
router.register(r"rides", RideViewSet, basename="ride")
|
||||
|
||||
# Park-related models
|
||||
router.register(r"park-areas", ParkAreaViewSet, basename="park-area")
|
||||
router.register(r"park-locations", ParkLocationViewSet, basename="park-location")
|
||||
|
||||
# Company models
|
||||
router.register(r"companies", CompanyViewSet, basename="company")
|
||||
|
||||
# Ride-related models
|
||||
router.register(r"ride-models", RideModelViewSet, basename="ride-model")
|
||||
router.register(
|
||||
r"roller-coaster-stats", RollerCoasterStatsViewSet, basename="roller-coaster-stats"
|
||||
)
|
||||
router.register(r"ride-locations", RideLocationViewSet, basename="ride-location")
|
||||
router.register(r"ride-reviews", RideReviewViewSet, basename="ride-review")
|
||||
|
||||
# User-related models
|
||||
router.register(r"user-profiles", UserProfileViewSet, basename="user-profile")
|
||||
router.register(r"top-lists", TopListViewSet, basename="top-list")
|
||||
router.register(r"top-list-items", TopListItemViewSet, basename="top-list-item")
|
||||
|
||||
# Register read-only endpoints for reference data
|
||||
router.register(r"ref/parks", ParkReadOnlyViewSet, basename="park-ref")
|
||||
router.register(r"ref/rides", RideReadOnlyViewSet, basename="ride-ref")
|
||||
|
||||
app_name = "api_v1"
|
||||
|
||||
urlpatterns = [
|
||||
# API Documentation endpoints
|
||||
path("schema/", SpectacularAPIView.as_view(), name="schema"),
|
||||
path(
|
||||
"docs/",
|
||||
SpectacularSwaggerView.as_view(url_name="api_v1:schema"),
|
||||
name="swagger-ui",
|
||||
),
|
||||
path(
|
||||
"redoc/", SpectacularRedocView.as_view(url_name="api_v1:schema"), name="redoc"
|
||||
),
|
||||
# Authentication endpoints
|
||||
path("auth/login/", LoginAPIView.as_view(), name="login"),
|
||||
path("auth/signup/", SignupAPIView.as_view(), name="signup"),
|
||||
path("auth/logout/", LogoutAPIView.as_view(), name="logout"),
|
||||
path("auth/user/", CurrentUserAPIView.as_view(), name="current-user"),
|
||||
path("auth/password/reset/", PasswordResetAPIView.as_view(), name="password-reset"),
|
||||
path(
|
||||
"auth/password/change/", PasswordChangeAPIView.as_view(), name="password-change"
|
||||
),
|
||||
path("auth/providers/", SocialProvidersAPIView.as_view(), name="social-providers"),
|
||||
path("auth/status/", AuthStatusAPIView.as_view(), name="auth-status"),
|
||||
# Health check endpoints
|
||||
path("health/", HealthCheckAPIView.as_view(), name="health-check"),
|
||||
path("health/simple/", SimpleHealthAPIView.as_view(), name="simple-health"),
|
||||
path(
|
||||
"health/performance/",
|
||||
PerformanceMetricsAPIView.as_view(),
|
||||
name="performance-metrics",
|
||||
),
|
||||
# History endpoints
|
||||
path(
|
||||
"history/timeline/",
|
||||
UnifiedHistoryViewSet.as_view({"get": "list"}),
|
||||
name="unified-history-timeline",
|
||||
),
|
||||
path(
|
||||
"parks/<str:park_slug>/history/",
|
||||
ParkHistoryViewSet.as_view({"get": "list"}),
|
||||
name="park-history-list",
|
||||
),
|
||||
path(
|
||||
"parks/<str:park_slug>/history/detail/",
|
||||
ParkHistoryViewSet.as_view({"get": "retrieve"}),
|
||||
name="park-history-detail",
|
||||
),
|
||||
path(
|
||||
"parks/<str:park_slug>/rides/<str:ride_slug>/history/",
|
||||
RideHistoryViewSet.as_view({"get": "list"}),
|
||||
name="ride-history-list",
|
||||
),
|
||||
path(
|
||||
"parks/<str:park_slug>/rides/<str:ride_slug>/history/detail/",
|
||||
RideHistoryViewSet.as_view({"get": "retrieve"}),
|
||||
name="ride-history-detail",
|
||||
),
|
||||
# Include all router-generated URLs
|
||||
path("", include(router.urls)),
|
||||
]
|
||||
Reference in New Issue
Block a user