30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
"""
|
|
URL маршруты для уведомлений.
|
|
"""
|
|
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
from .views import (
|
|
NotificationViewSet,
|
|
NotificationPreferenceViewSet,
|
|
ParentChildNotificationSettingsViewSet,
|
|
PushSubscriptionView
|
|
)
|
|
from .telegram_views import telegram_webhook, telegram_webhook_info
|
|
|
|
router = DefaultRouter()
|
|
# Пустой префикс: list → api/notifications/, detail → api/notifications/<id>/, unread → api/notifications/unread/
|
|
router.register(r'', NotificationViewSet, basename='notification')
|
|
router.register(r'preferences', NotificationPreferenceViewSet, basename='notification-preference')
|
|
router.register(r'parent-child-settings', ParentChildNotificationSettingsViewSet, basename='parent-child-notification-settings')
|
|
|
|
urlpatterns = [
|
|
path('', include(router.urls)),
|
|
|
|
# Push Notifications
|
|
path('push-subscription/', PushSubscriptionView.as_view(), name='push-subscription'),
|
|
|
|
# Telegram webhook
|
|
path('telegram/webhook/', telegram_webhook, name='telegram-webhook'),
|
|
path('telegram/webhook/info/', telegram_webhook_info, name='telegram-webhook-info'),
|
|
]
|