Corp/backend/api/v1/urls.py
igor_nadein 58e341e295 feat: Add DocumentComment model and related documents support
- Added related_documents ManyToMany field to Document model
- Created DocumentComment model with threading support (parent/replies)
- Created DocumentCommentViewSet with CRUD and permission checks
- Added endpoints for related documents:
  * GET /documents/{id}/related/ - list related documents
  * POST /documents/{id}/add_related/ - add related document
  * POST /documents/{id}/remove_related/ - remove related document
- DocumentComment features:
  * Threading support via parent field
  * Edit tracking (is_edited flag)
  * Author-only deletion (or staff)
  * Depth calculation for nested comments
- Created migration 0010 for new fields and model
- Registered DocumentCommentViewSet in router

All medium-priority features complete!
2026-02-28 14:38:59 +03:00

104 lines
3.6 KiB
Python

from django.urls import include, path
from rest_framework.routers import DefaultRouter
# django-scheduler ViewSets (проверенная библиотека для календаря)
from .schedule.views import (
ScheduleCalendarViewSet,
ScheduleEventViewSet,
ScheduleRuleViewSet,
ScheduleOccurrenceViewSet,
ScheduleEventRelationViewSet,
)
# Communications ViewSets
from .communications.views import ChatViewSet, MessageViewSet, PollViewSet
from .documents.views import (
DocumentViewSet,
FolderViewSet,
DocumentTagViewSet,
DocumentTypeViewSet,
CabinetViewSet,
DocumentCommentViewSet,
)
from .employees.views import (
DepartmentRoleViewSet,
DepartmentViewSet,
EmployeeActionViewSet,
EmployeeViewSet,
GroupViewSet,
PositionViewSet,
RegisterAPIView,
ResendEmailAPIView,
SkillViewSet,
VerifyEmailAPIView,
)
from .feed.views import CommentViewSet, PostViewSet
from .requests_app.views import RequestViewSet
from .search.views import search_api_view
app_name = "v1"
router = DefaultRouter()
# django-scheduler endpoints (проверенная библиотека)
router.register(r"schedule/calendars", ScheduleCalendarViewSet, basename="schedule-calendars")
router.register(r"schedule/events", ScheduleEventViewSet, basename="schedule-events")
router.register(r"schedule/rules", ScheduleRuleViewSet, basename="schedule-rules")
router.register(r"schedule/occurrences", ScheduleOccurrenceViewSet, basename="schedule-occurrences")
router.register(r"schedule/relations", ScheduleEventRelationViewSet, basename="schedule-relations")
router.register(r"documents", DocumentViewSet, basename="documents")
router.register(r"folders", FolderViewSet, basename="folders")
router.register(r"document-tags", DocumentTagViewSet, basename="document-tags")
router.register(r"document-types", DocumentTypeViewSet, basename="document-types")
router.register(r"cabinets", CabinetViewSet, basename="cabinets")
router.register(r"document-comments", DocumentCommentViewSet, basename="document-comments")
router.register(r"requests", RequestViewSet, basename="request")
router.register(r"departments", DepartmentViewSet, basename="departments")
router.register(r"employees", EmployeeViewSet, basename="employees")
router.register(
r"employee-actions",
EmployeeActionViewSet,
basename="employee-actions",
)
router.register(r"positions", PositionViewSet, basename="positions")
router.register(
r"department-roles",
DepartmentRoleViewSet,
basename="department-roles",
)
router.register(r"skills", SkillViewSet, basename="skills")
router.register(r"posts", PostViewSet, basename="posts")
router.register(r"comments", CommentViewSet, basename="comments")
router.register(r"groups", GroupViewSet, basename="groups")
# NEW: Communications ViewSets
router.register(r"communications/chats", ChatViewSet, basename="chats")
router.register(r"communications/messages", MessageViewSet, basename="messages")
router.register(r"communications/polls", PollViewSet, basename="polls")
urlpatterns = [
path("auth/register/", RegisterAPIView.as_view(), name="register"),
path(
"auth/resend-email/",
ResendEmailAPIView.as_view(),
name="resend-email",
),
path(
"auth/verify-email/",
VerifyEmailAPIView.as_view(),
name="verify-email",
),
# Notifications API
path("notifications/", include("api.v1.notifications.urls")),
# Procurement API
path("procurement/", include("api.v1.procurement.urls")),
# Search API
path("search/", search_api_view, name="search"),
# Router URLs (включая все ViewSets)
path("", include(router.urls)),
]