You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

62 lines
4.3 KiB

from django.urls import path
from .views.category import HadisCategorySectListView, HadisCategoryTreeView, CategoriesView, CategoriesBySectView, HadisCategorySelectBySectView, HadisCategorySelectBySectSourceView , HadisCategoryTreeNormalView ,test_deploy,debug_headers,HadisCategoryXMindView
from .views.hadis import HadisCollectionListView, HadisListView, HadisBasicView, HadisDetailView, HadisSyncView, HadisTransmittersView, HadisCorrectionsView,HadisMainListView, HadisFiltersView, HadisLayersView,PinnedHadisCollectionListView
from .views.transmitter import TransmitterView ,TransmitterDetailView, TransmitterSyncView,TransmitterOpinionView, TransmitterOriginalTextView, TransmitterFiltersView
from .views.reference import BookDetailView, BookReferencesView, BookReferenceSyncView, BookAttributeView
from .views.version import ContentReleaseSyncView
from .views.info import HadisInfoView
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_headers
# Helper function to avoid ugly nesting
def cached_view(view_func):
return cache_page(60*60*2,key_prefix='hadis_api')(vary_on_headers('Accept-Language')(view_func))
urlpatterns = [
# Most specific first (with parameters)
path('pinned-collections/', PinnedHadisCollectionListView.as_view(), name='pinned-hadis-collection-list'),
path('collections/', HadisCollectionListView.as_view(), name='hadis-collection-list'),
path('sync/sects/', HadisCategorySectListView.as_view(), name='hadis-sect-list'),
path('sync/categories/tree/', HadisCategoryTreeView.as_view(), name='hadis-category-tree'),
path('sync/hadis/', HadisSyncView.as_view(), name='hadis-sync'),
path('sync/narrators/', TransmitterSyncView.as_view(), name='transmitter-sync'),
path('sync/references/', BookReferenceSyncView.as_view(), name='reference-sync'),
path('sync/version/', ContentReleaseSyncView.as_view(), name='content-release-sync'),
path('info/', HadisInfoView.as_view(), name='hadis-info'),
# Category paths (more specific first)
path('categories/tree/', HadisCategoryTreeNormalView.as_view(), name='hadis-category-tree-normal'),
path('categories/<str:sect_type>/<str:slug>/<str:source_type>/', HadisCategorySelectBySectSourceView.as_view(), name='categories-tree-by-sect-source'),
path('categories/<str:sect_type>/<str:slug>/', HadisCategorySelectBySectView.as_view(), name='categories-tree-by-sect'),
path('categories/<str:sect_type>/', CategoriesBySectView.as_view(), name='categories-by-sect'),
path('categories/', CategoriesView.as_view(), name='categories'), # ← Least specific LAST
# Hadis paths
path('category/<str:category_slug>/xmind/', HadisCategoryXMindView.as_view(), name='hadis-category-xmind'), # ← Must be before other category paths
path('category/<str:category_slug>/', HadisListView.as_view(), name='hadis-list'),
path('arguments/', HadisMainListView.as_view(), name='hadis-main-list'),
path('arguments/filters/', HadisFiltersView.as_view(), name='hadis-filters'),
# Narrator paths
path('narrators/<str:narrator_slug>/opinions', TransmitterOpinionView.as_view(), name='narrator-opinions'),
path('narrators/<str:narrator_slug>/original_texts', TransmitterOriginalTextView.as_view(), name='narrator-original-texts'),
path('narrators/<str:narrator_slug>', TransmitterDetailView.as_view(), name='narrator-detail'),
path('narrators/filters/', TransmitterFiltersView.as_view(), name='narrator-filters'),
path('narrators/', TransmitterView.as_view(), name='narrators'),
# Reference paths
path('references/<str:reference_slug>', BookDetailView.as_view(), name='reference-detail'),
path('references/', BookReferencesView.as_view(), name='references'),
# Hadis detail paths (with slug, more specific)
path('<str:hadis_slug>/detail/', HadisDetailView.as_view(), name='hadis-detail'),
path('<str:hadis_slug>/transmitters/', HadisTransmittersView.as_view(), name='hadis-transmitters'),
path('<str:hadis_slug>/transmitters/layers/', HadisLayersView.as_view(), name='hadis-layers'),
path('<str:hadis_slug>/corrections/', HadisCorrectionsView.as_view(), name='hadis-corrections'),
path('<str:hadis_slug>/', HadisBasicView.as_view(), name='hadis-basic'), # ← Least specific LAST
# path('test/test-deploy',test_deploy , name='test'),
# path('debug-headers',debug_headers , name='headers'),
]