crmbackend/crm/urls.py
2026-08-16 15:40:34 +05:30

59 lines
3.8 KiB
Python

from django.urls import path
from crm.views import auth_views, seller_views, customer_views, product_views, wallet_views, debug_views, dashboard_views, category_views
urlpatterns = [
# Auth
path('auth/login/', auth_views.CRMTokenObtainPairView.as_view(), name='token_obtain_pair'),
path('auth/me/', auth_views.get_current_admin, name='current_admin'),
# Dashboard
path('dashboard/', dashboard_views.get_dashboard_stats, name='get_dashboard_stats'),
path('audit-logs/', dashboard_views.list_audit_logs, name='list_audit_logs'),
# Sellers
path('sellers/', seller_views.list_sellers, name='list_sellers'),
path('sellers/<int:pk>/', seller_views.get_seller_detail, name='get_seller_detail'),
path('sellers/<int:pk>/documents/', seller_views.get_seller_documents, name='get_seller_documents'),
path('sellers/documents/preview/', seller_views.preview_document, name='preview_document'),
path('sellers/<int:pk>/documents/<str:doc_id>/approve/', seller_views.approve_seller_document, name='approve_seller_document'),
path('sellers/<int:pk>/approve/', seller_views.approve_seller, name='approve_seller'),
path('sellers/<int:pk>/reject/', seller_views.reject_seller, name='reject_seller'),
path('sellers/<int:pk>/suspend/', seller_views.suspend_seller, name='suspend_seller'),
path('sellers/<int:pk>/reinstate/', seller_views.reinstate_seller, name='reinstate_seller'),
path('sellers/<int:pk>/reset-password/', seller_views.reset_seller_password, name='reset_seller_password'),
path('sellers/<int:pk>/delete/', seller_views.delete_seller, name='delete_seller'),
# Customers
path('customers/', customer_views.list_customers, name='list_customers'),
path('customers/<int:pk>/', customer_views.get_customer_detail, name='get_customer_detail'),
path('customers/<int:pk>/suspend/', customer_views.suspend_customer, name='suspend_customer'),
path('customers/<int:pk>/ban/', customer_views.ban_customer, name='ban_customer'),
path('customers/<int:pk>/orders/<int:order_id>/payment/', customer_views.get_payment_status, name='get_payment_status'),
path('customers/<int:pk>/orders/<int:order_id>/refund/', customer_views.issue_refund, name='issue_refund'),
path('customers/<int:pk>/orders/<int:order_id>/return-pickup/', customer_views.create_return_pickup, name='create_return_pickup'),
# Products
path('products/', product_views.list_products, name='list_products'),
path('products/<int:pk>/approve/', product_views.approve_product, name='approve_product'),
path('products/<int:pk>/hold/', product_views.hold_product, name='hold_product'),
path('products/<int:pk>/reject/', product_views.reject_product, name='reject_product'),
path('products/<int:pk>/map-category/', category_views.map_product_category, name='map_product_category'),
path('products/<int:pk>/', product_views.delete_product, name='delete_product'),
# Categories
path('categories/', category_views.list_categories, name='list_categories'),
path('categories/create/', category_views.create_category, name='create_category'),
# Wallet / Withdrawals
path('wallets/withdrawals/', wallet_views.list_withdrawals, name='list_withdrawals'),
path('wallets/withdrawals/<int:pk>/approve/', wallet_views.approve_withdrawal, name='approve_withdrawal'),
path('wallets/withdrawals/<int:pk>/reject/', wallet_views.reject_withdrawal, name='reject_withdrawal'),
# Central control & debugging endpoints
path('debug/status/', debug_views.service_status, name='service_status'),
path('debug/control/', debug_views.service_control, name='service_control'),
path('debug/logs/', debug_views.list_and_search_logs, name='list_and_search_logs'),
path('debug/sysinfo/', debug_views.system_diagnostics, name='system_diagnostics'),
path('debug/run-command/', debug_views.run_management_command, name='run_management_command'),
]