fix(realtime): добавлены правильные обработчики уведомлений

- Переименован notification_created → notification_new
- Переименован notification_count → notification_count_update
- Теперь совместимы с notifications/services.py
- Исправлена ошибка 'No handler for message type notification_new'
This commit is contained in:
admin i 2025-12-03 12:59:12 +03:00
parent 7346f2977a
commit 95447bae97

View File

@ -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)