mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-27 08:07:04 -05:00
130 lines
5.0 KiB
Python
130 lines
5.0 KiB
Python
"""Comprehensive URL routes for Parks domain (API v1).
|
|
|
|
This file exposes a maximal set of "full-fat" endpoints implemented in
|
|
`apps.api.v1.parks.park_views` and `apps.api.v1.parks.views`. Endpoints are
|
|
intentionally expansive to match the rides API functionality and provide
|
|
complete feature parity for parks management.
|
|
"""
|
|
|
|
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .park_views import (
|
|
ParkListCreateAPIView,
|
|
ParkDetailAPIView,
|
|
FilterOptionsAPIView,
|
|
CompanySearchAPIView,
|
|
ParkSearchSuggestionsAPIView,
|
|
ParkImageSettingsAPIView,
|
|
OperatorListAPIView,
|
|
)
|
|
from .park_rides_views import (
|
|
ParkRidesListAPIView,
|
|
ParkRideDetailAPIView,
|
|
ParkComprehensiveDetailAPIView,
|
|
)
|
|
from apps.parks.views import location_search, reverse_geocode
|
|
from .views import ParkPhotoViewSet, HybridParkAPIView, ParkFilterMetadataAPIView
|
|
from .ride_photos_views import RidePhotoViewSet
|
|
from .ride_photos_views import RidePhotoViewSet
|
|
from .ride_reviews_views import RideReviewViewSet
|
|
from apps.parks.views_roadtrip import (
|
|
CreateTripView,
|
|
FindParksAlongRouteView,
|
|
GeocodeAddressView,
|
|
ParkDistanceCalculatorView,
|
|
)
|
|
|
|
# Create router for nested photo endpoints
|
|
router = DefaultRouter()
|
|
router.register(r"", ParkPhotoViewSet, basename="park-photo")
|
|
|
|
# Create routers for nested ride endpoints
|
|
ride_photos_router = DefaultRouter()
|
|
ride_photos_router.register(r"", RidePhotoViewSet, basename="ride-photo")
|
|
from .ride_reviews_views import RideReviewViewSet
|
|
|
|
ride_reviews_router = DefaultRouter()
|
|
ride_reviews_router.register(r"", RideReviewViewSet, basename="ride-review")
|
|
|
|
from .park_reviews_views import ParkReviewViewSet
|
|
from .history_views import ParkHistoryViewSet, RideHistoryViewSet
|
|
|
|
# Create routers for nested park endpoints
|
|
reviews_router = DefaultRouter()
|
|
reviews_router.register(r"", ParkReviewViewSet, basename="park-review")
|
|
|
|
|
|
app_name = "api_v1_parks"
|
|
|
|
urlpatterns = [
|
|
# Core list/create endpoints
|
|
path("", ParkListCreateAPIView.as_view(), name="park-list-create"),
|
|
|
|
# Hybrid filtering endpoints
|
|
path("hybrid/", HybridParkAPIView.as_view(), name="park-hybrid-list"),
|
|
path("hybrid/filter-metadata/", ParkFilterMetadataAPIView.as_view(), name="park-hybrid-filter-metadata"),
|
|
|
|
# Filter options
|
|
path("filter-options/", FilterOptionsAPIView.as_view(), name="park-filter-options"),
|
|
# Autocomplete / suggestion endpoints
|
|
path(
|
|
"search/companies/",
|
|
CompanySearchAPIView.as_view(),
|
|
name="park-search-companies",
|
|
),
|
|
path(
|
|
"search-suggestions/",
|
|
ParkSearchSuggestionsAPIView.as_view(),
|
|
name="park-search-suggestions",
|
|
),
|
|
# Detail and action endpoints - supports both ID and slug
|
|
path("<str:pk>/", ParkDetailAPIView.as_view(), name="park-detail"),
|
|
|
|
# Park rides endpoints
|
|
path("<str:park_slug>/rides/", ParkRidesListAPIView.as_view(), name="park-rides-list"),
|
|
path("<str:park_slug>/rides/<str:ride_slug>/", ParkRideDetailAPIView.as_view(), name="park-ride-detail"),
|
|
|
|
# Comprehensive park detail endpoint with rides summary
|
|
path("<str:park_slug>/detail/", ParkComprehensiveDetailAPIView.as_view(), name="park-comprehensive-detail"),
|
|
|
|
# Park image settings endpoint
|
|
path(
|
|
"<int:pk>/image-settings/",
|
|
ParkImageSettingsAPIView.as_view(),
|
|
name="park-image-settings",
|
|
),
|
|
# Park photo endpoints - domain-specific photo management
|
|
path("<str:park_pk>/photos/", include(router.urls)),
|
|
|
|
# Nested ride photo endpoints - photos for specific rides within parks
|
|
path("<str:park_slug>/rides/<str:ride_slug>/photos/", include(ride_photos_router.urls)),
|
|
|
|
# Nested ride review endpoints - reviews for specific rides within parks
|
|
path("<str:park_slug>/rides/<str:ride_slug>/reviews/", include(ride_reviews_router.urls)),
|
|
# Nested ride review endpoints - reviews for specific rides within parks
|
|
path("<str:park_slug>/rides/<str:ride_slug>/reviews/", include(ride_reviews_router.urls)),
|
|
|
|
# Ride History
|
|
path("<str:park_slug>/rides/<str:ride_slug>/history/", RideHistoryViewSet.as_view({'get': 'list'}), name="ride-history"),
|
|
|
|
# Park Reviews
|
|
path("<str:park_slug>/reviews/", include(reviews_router.urls)),
|
|
|
|
# Park History
|
|
path("<str:park_slug>/history/", ParkHistoryViewSet.as_view({'get': 'list'}), name="park-history"),
|
|
|
|
# Roadtrip API endpoints
|
|
path("roadtrip/create/", CreateTripView.as_view(), name="roadtrip-create"),
|
|
path("roadtrip/find-along-route/", FindParksAlongRouteView.as_view(), name="roadtrip-find"),
|
|
path("roadtrip/geocode/", GeocodeAddressView.as_view(), name="roadtrip-geocode"),
|
|
path("roadtrip/distance/", ParkDistanceCalculatorView.as_view(), name="roadtrip-distance"),
|
|
|
|
# Operator endpoints
|
|
path("operators/", OperatorListAPIView.as_view(), name="operator-list"),
|
|
|
|
# Location search endpoints
|
|
path("search/location/", location_search, name="location-search"),
|
|
path("search/reverse-geocode/", reverse_geocode, name="reverse-geocode"),
|
|
]
|