simple-plant-archive-django/plant_catalog/catalog/urls.py
2026-06-20 07:06:19 +02:00

18 lines
888 B
Python
Executable file

# catalog/urls.py
from django.http import HttpResponseRedirect
from django.urls import path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from .api_views import PlantListCreateAPIView, PlantRetrieveUpdateDestroyAPIView, PlantImageDeleteAPIView
urlpatterns = [
path('', lambda request: HttpResponseRedirect('/api/plants/')),
path('api/plants/', PlantListCreateAPIView.as_view(), name='plant_list_create'), # List and Create
path('api/plants/<int:pk>/', PlantRetrieveUpdateDestroyAPIView.as_view(), name='plant_detail_update_delete'), # Retrieve, Update, Delete
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('api/plant-images/<int:image_id>/', PlantImageDeleteAPIView.as_view(), name='plant_image_delete'),
]