Files
aurora-moments/api/apps/moments/urls.py
T

20 lines
941 B
Python
Raw Normal View History

from django.urls import path
from rest_framework.routers import DefaultRouter
from .views import CommentViewSet, MomentViewSet, ReactionViewSet
router = DefaultRouter()
router.register("", MomentViewSet, basename="moment")
comments_list = CommentViewSet.as_view({"get": "list", "post": "create"})
comments_detail = CommentViewSet.as_view({"get": "retrieve", "delete": "destroy"})
reactions_list = ReactionViewSet.as_view({"get": "list", "post": "create"})
reactions_detail = ReactionViewSet.as_view({"get": "retrieve", "delete": "destroy"})
urlpatterns = [
path("<int:moment_pk>/comments/", comments_list, name="moment-comments-list"),
path("<int:moment_pk>/comments/<int:pk>/", comments_detail, name="moment-comments-detail"),
path("<int:moment_pk>/reactions/", reactions_list, name="moment-reactions-list"),
path("<int:moment_pk>/reactions/<int:pk>/", reactions_detail, name="moment-reactions-detail"),
] + router.urls