2025-04-07 12:41:47 +08:00
|
|
|
from django.urls import path, include
|
|
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .views import (
|
|
|
|
KnowledgeBaseViewSet,
|
|
|
|
PermissionViewSet,
|
|
|
|
NotificationViewSet,
|
|
|
|
verify_token,
|
|
|
|
user_list,
|
|
|
|
user_detail,
|
|
|
|
user_update,
|
|
|
|
user_delete,
|
|
|
|
change_password,
|
|
|
|
RegisterView,
|
|
|
|
LoginView,
|
|
|
|
LogoutView,
|
2025-04-10 18:25:59 +08:00
|
|
|
ChatHistoryViewSet,
|
|
|
|
user_profile,
|
|
|
|
user_register,
|
|
|
|
setup_gmail_integration,
|
|
|
|
send_gmail_message,
|
|
|
|
gmail_webhook,
|
|
|
|
get_gmail_attachments,
|
|
|
|
download_gmail_attachment,
|
|
|
|
get_gmail_talents,
|
|
|
|
refresh_gmail_watch,
|
|
|
|
check_gmail_auth,
|
|
|
|
import_gmail_from_sender,
|
|
|
|
sync_talent_emails
|
2025-04-07 12:41:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# 创建路由器
|
|
|
|
router = DefaultRouter()
|
|
|
|
|
|
|
|
# 注册视图集
|
|
|
|
router.register(r'knowledge-bases', KnowledgeBaseViewSet, basename='knowledge-bases')
|
|
|
|
router.register(r'permissions', PermissionViewSet, basename='permission')
|
|
|
|
router.register(r'notifications', NotificationViewSet, basename='notification')
|
|
|
|
router.register(r'chat-history', ChatHistoryViewSet, basename='chat-history')
|
|
|
|
|
|
|
|
# URL patterns
|
|
|
|
urlpatterns = [
|
|
|
|
# API 路由
|
|
|
|
path('', include(router.urls)),
|
|
|
|
|
|
|
|
# 用户认证相关
|
|
|
|
path('auth/register/', RegisterView.as_view(), name='register'),
|
|
|
|
path('auth/login/', LoginView.as_view(), name='login'),
|
|
|
|
path('auth/logout/', LogoutView.as_view(), name='logout'),
|
|
|
|
path('auth/verify-token/', verify_token, name='verify-token'),
|
|
|
|
path('auth/change-password/', change_password, name='change-password'),
|
|
|
|
|
|
|
|
# 用户管理相关
|
|
|
|
path('users/', user_list, name='user-list'),
|
|
|
|
path('users/<str:pk>/', user_detail, name='user-detail'),
|
|
|
|
path('users/<str:pk>/update/', user_update, name='user-update'),
|
|
|
|
path('users/<str:pk>/delete/', user_delete, name='user-delete'),
|
2025-04-10 18:25:59 +08:00
|
|
|
|
|
|
|
# Gmail集成API
|
|
|
|
path('gmail/setup/', setup_gmail_integration, name='setup_gmail_integration'),
|
|
|
|
path('gmail/send/', send_gmail_message, name='send_gmail_message'),
|
|
|
|
path('gmail/webhook/', gmail_webhook, name='gmail_webhook'),
|
|
|
|
path('gmail/attachments/', get_gmail_attachments, name='get_gmail_attachments'),
|
|
|
|
path('gmail/download/', download_gmail_attachment, name='download_gmail_attachment'),
|
|
|
|
path('gmail/talents/', get_gmail_talents, name='get_gmail_talents'),
|
|
|
|
path('gmail/refresh-watch/', refresh_gmail_watch, name='refresh_gmail_watch'),
|
|
|
|
path('gmail/check-auth/', check_gmail_auth, name='check_gmail_auth'),
|
|
|
|
path('gmail/import-from-sender/', import_gmail_from_sender, name='import_gmail_from_sender'),
|
|
|
|
path('gmail/sync-talent/', sync_talent_emails, name='sync_talent_emails'),
|
2025-04-07 12:41:47 +08:00
|
|
|
]
|