lizerk aa614bb4c1 refactor: Переписан API v1 и services для новой архитектуры
BREAKING CHANGES:
- API полностью переписан под новую модель (verb вместо category/type)
- NotificationService заменен на stub с NotImplementedError
- Удалена обратная совместимость

API endpoints (обновлены):
- GET /api/v1/notifications/ - новый формат ответа
- GET /api/v1/notifications/verb-types/ - вместо categories
- GET/PUT /api/v1/notifications/preferences/ - вместо settings
- POST /api/v1/notifications/<id>/unread/ - новый endpoint
- DELETE /api/v1/notifications/delete-all-read/ - новый endpoint

Удалены endpoints:
- /api/v1/notifications/categories/ (нет категорий в v2)
- /api/v1/notifications/settings/* (заменено на preferences)
- /api/v1/notifications/telegram/* (Telegram отключен)
- /api/v1/notifications/push/vapid-key/ (не нужен)
- /api/v1/notifications/push/subscriptions/ (не нужен)

services.py:
- Заменен на stub с NotImplementedError
- Все методы выбрасывают исключения с подсказками миграции
- Документация как мигрировать со старого API

Новая структура ответа API:
- verb вместо category/type
- actor (GenericForeignKey) вместо sender
- description вместо message/title
- timesince() вместо created_at
- unread вместо is_read

Старые файлы:
- Удалены все *.old файлы
2026-03-09 16:40:59 +03:00

33 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
URL routing для API v2 уведомлений.
Новая архитектура: verb-based notifications с channel preferences.
"""
from django.urls import path
from . import views
app_name = 'notifications_api_v1'
urlpatterns = [
# Список и счетчики
path('', views.get_notifications, name='list'),
path('count/', views.get_unread_count, name='count'),
path('verb-types/', views.get_verb_types, name='verb_types'),
# Операции с уведомлениями
path('<int:notification_id>/read/', views.mark_as_read, name='mark_read'),
path('<int:notification_id>/unread/', views.mark_as_unread, name='mark_unread'),
path('<int:notification_id>/', views.delete_notification, name='delete'),
# Массовые операции
path('read-all/', views.mark_all_as_read, name='mark_all_read'),
path('delete-all-read/', views.delete_all_read, name='delete_all_read'),
# Настройки каналов
path('preferences/', views.channel_preferences, name='preferences'),
# Web Push интеграция
path('push/subscribe/', views.subscribe_push, name='push_subscribe'),
path('push/unsubscribe/', views.unsubscribe_push, name='push_unsubscribe'),
]