- ApiClient теперь обрабатывает 401 и 403 ошибки для обновления токена - Добавлен JWTRefreshMiddleware для проактивного обновления токенов за 5 минут до истечения - Добавлена настройка JWT_REFRESH_THRESHOLD_MINUTES (по умолчанию 5) - Исправлена проблема с периодическими 403 ошибками после истечения access token
102 lines
2.5 KiB
Python
102 lines
2.5 KiB
Python
# backend/communications/urls.py
|
|
|
|
from django.urls import path
|
|
|
|
from . import api_views, views
|
|
|
|
app_name = "communications"
|
|
|
|
urlpatterns = [
|
|
# UI Views
|
|
path("chats/", views.ChatListView.as_view(), name="chat_list"),
|
|
path("chats/<int:pk>/", views.ChatDetailView.as_view(), name="chat_detail"),
|
|
path(
|
|
"chats/start/<int:employee_pk>/",
|
|
views.start_private_chat,
|
|
name="start_private_chat"
|
|
),
|
|
path("chats/<int:pk>/mark-read/", views.chat_mark_read, name="chat_mark_read"),
|
|
path(
|
|
"start/private/<int:employee_pk>/",
|
|
views.start_private_chat,
|
|
name="start_private_chat"
|
|
),
|
|
|
|
# API Endpoints
|
|
# Chat management
|
|
path("api/chat/create/", api_views.create_chat, name="api_create_chat"),
|
|
path(
|
|
"api/chat/<int:chat_id>/update/",
|
|
api_views.update_chat,
|
|
name="api_update_chat"
|
|
),
|
|
path(
|
|
"api/chat/<int:chat_id>/pin/",
|
|
api_views.pin_chat,
|
|
name="api_pin_chat"
|
|
),
|
|
path(
|
|
"api/chat/<int:chat_id>/notifications/",
|
|
api_views.set_chat_notifications,
|
|
name="api_chat_notifications"
|
|
),
|
|
|
|
# Message actions
|
|
path(
|
|
"api/message/<int:message_id>/edit/",
|
|
api_views.edit_message,
|
|
name="api_edit_message"
|
|
),
|
|
path(
|
|
"api/message/<int:message_id>/delete/",
|
|
api_views.delete_message,
|
|
name="api_delete_message"
|
|
),
|
|
path(
|
|
"api/message/<int:message_id>/react/",
|
|
api_views.add_reaction,
|
|
name="api_add_reaction"
|
|
),
|
|
path(
|
|
"api/message/<int:message_id>/unreact/",
|
|
api_views.remove_reaction,
|
|
name="api_remove_reaction"
|
|
),
|
|
path(
|
|
"api/message/<int:message_id>/pin/",
|
|
api_views.pin_message,
|
|
name="api_pin_message"
|
|
),
|
|
|
|
# Attachments
|
|
path(
|
|
"api/attachment/upload/",
|
|
api_views.upload_attachment,
|
|
name="api_upload_attachment"
|
|
),
|
|
|
|
# Forward & Reply
|
|
path(
|
|
"api/message/<int:message_id>/forward/",
|
|
api_views.forward_message,
|
|
name="api_forward_message"
|
|
),
|
|
path(
|
|
"api/message/<int:message_id>/reply/",
|
|
api_views.reply_to_message,
|
|
name="api_reply_message"
|
|
),
|
|
|
|
# Membership
|
|
path(
|
|
"api/chat/<int:chat_id>/member/add/",
|
|
api_views.add_member,
|
|
name="api_add_member"
|
|
),
|
|
path(
|
|
"api/chat/<int:chat_id>/member/remove/",
|
|
api_views.remove_member,
|
|
name="api_remove_member"
|
|
),
|
|
]
|