From 95447bae978ee5fddfe0f28eb4092289ded066c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Wed, 3 Dec 2025 12:59:12 +0300 Subject: [PATCH] =?UTF-8?q?fix(realtime):=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D1=87=D0=B8=D0=BA=D0=B8=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Переименован notification_created → notification_new - Переименован notification_count → notification_count_update - Теперь совместимы с notifications/services.py - Исправлена ошибка 'No handler for message type notification_new' --- backend/realtime/consumers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/realtime/consumers.py b/backend/realtime/consumers.py index 265dad78..819dbac3 100644 --- a/backend/realtime/consumers.py +++ b/backend/realtime/consumers.py @@ -368,15 +368,18 @@ class UserConsumer(AsyncJsonWebsocketConsumer): # ==================== Обработчики уведомлений ==================== - async def notification_created(self, event): - """Новое уведомление""" + async def notification_new(self, event): + """Новое уведомление (вызывается из notifications/services.py)""" await self.send_json({ "type": "notification", "notification": event.get("notification", {}) }) - async def notification_count(self, event): - """Обновление счетчика уведомлений""" + async def notification_count_update(self, event): + """ + Обновление счетчика уведомлений. + Вызывается из notifications/services.py + """ await self.send_json({ "type": "unread_count", "count": event.get("count", 0)