CartItemView was registered on both /cart/items/ and
/cart/items/{item_uuid}/, so swagger listed POST/PATCH/DELETE on both
paths even though 3 of those 6 combinations raised a TypeError at
runtime (missing/unexpected item_uuid). Split into CartItemView (POST,
list path) and CartItemDetailView (PATCH/DELETE, detail path).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
917 B
Python
28 lines
917 B
Python
from django.urls import path
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .views import (
|
|
CartItemDetailView,
|
|
CartItemView,
|
|
CartView,
|
|
CheckoutView,
|
|
NotificationViewSet,
|
|
OrderGroupViewSet,
|
|
OrderViewSet,
|
|
SellerOrderViewSet,
|
|
)
|
|
|
|
app_name = "orders"
|
|
|
|
router = DefaultRouter()
|
|
router.register('order-groups', OrderGroupViewSet, basename='order-group')
|
|
router.register('orders', OrderViewSet, basename='order')
|
|
router.register('seller/orders', SellerOrderViewSet, basename='seller-order')
|
|
router.register('notifications', NotificationViewSet, basename='notification')
|
|
|
|
urlpatterns = router.urls + [
|
|
path('checkout/', CheckoutView.as_view(), name='checkout'),
|
|
path('cart/', CartView.as_view(), name='cart'),
|
|
path('cart/items/', CartItemView.as_view(), name='cart-items'),
|
|
path('cart/items/<uuid:item_uuid>/', CartItemDetailView.as_view(), name='cart-item-detail'),
|
|
]
|