HH/apps/standards/urls.py

53 lines
2.1 KiB
Python

from django.urls import path, include
from rest_framework.routers import DefaultRouter
from apps.standards.views import (
StandardSourceViewSet,
StandardCategoryViewSet,
StandardViewSet,
StandardComplianceViewSet,
StandardAttachmentViewSet,
standards_dashboard,
department_standards_view,
standard_detail,
standard_compliance_update,
standard_attachment_upload,
standards_search,
get_compliance_status,
standard_create,
create_compliance_ajax,
update_compliance_ajax,
)
# API Router
router = DefaultRouter()
router.register(r'sources', StandardSourceViewSet, basename='standard-source')
router.register(r'categories', StandardCategoryViewSet, basename='standard-category')
router.register(r'standards', StandardViewSet, basename='standard')
router.register(r'compliance', StandardComplianceViewSet, basename='standard-compliance')
router.register(r'attachments', StandardAttachmentViewSet, basename='standard-attachment')
app_name = 'standards'
urlpatterns = [
# API endpoints
path('api/', include(router.urls)),
# API endpoint for compliance status
path('api/compliance/<uuid:department_id>/<uuid:standard_id>/', get_compliance_status, name='compliance_status'),
# UI Views
path('', standards_dashboard, name='dashboard'),
path('search/', standards_search, name='search'),
path('departments/<uuid:pk>/', department_standards_view, name='department_standards'),
path('departments/<uuid:department_id>/create-standard/', standard_create, name='standard_create'),
path('standards/create/', standard_create, name='standard_create_global'),
path('standards/<uuid:pk>/', standard_detail, name='standard_detail'),
path('compliance/<uuid:compliance_id>/update/', standard_compliance_update, name='standard_compliance_update'),
path('attachments/upload/<uuid:compliance_id>/', standard_attachment_upload, name='attachment_upload'),
# AJAX endpoints
path('api/compliance/create/', create_compliance_ajax, name='compliance_create_ajax'),
path('api/compliance/update/', update_compliance_ajax, name='compliance_update_ajax'),
]