from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import GroupViewSet, PostViewSet, CommentViewSet # <<<< 确保 CommentViewSet 已导入

app_name = 'groups'

router = DefaultRouter()
router.register(r'groups', GroupViewSet, basename='group')
router.register(r'posts', PostViewSet, basename='post')
router.register(r'comments', CommentViewSet, basename='comment') # <<<< 新增注册 CommentViewSet

urlpatterns = [
    # router.urls 会自动包含为 GroupViewSet, PostViewSet, CommentViewSet 生成的所有标准URL
    # 以及它们各自通过 @action 定义的路由
    path('', include(router.urls)),
]