* feat: added api to get notifications for users * feat: added api to get count of notifications * feat: added api to mark notifications as seen * feat: added index on app_name in notification table * refactor: updated api view parent and url * refactor: resolved linter issue
37 lines
980 B
Python
37 lines
980 B
Python
"""
|
|
URLs for the notifications API.
|
|
"""
|
|
from django.conf import settings
|
|
from django.urls import path, re_path
|
|
from rest_framework import routers
|
|
|
|
from .views import (
|
|
CourseEnrollmentListView,
|
|
MarkNotificationsUnseenAPIView,
|
|
NotificationCountView,
|
|
NotificationListAPIView,
|
|
UserNotificationPreferenceView
|
|
)
|
|
|
|
router = routers.DefaultRouter()
|
|
|
|
|
|
urlpatterns = [
|
|
path('enrollments/', CourseEnrollmentListView.as_view(), name='enrollment-list'),
|
|
re_path(
|
|
fr'^configurations/{settings.COURSE_KEY_PATTERN}$',
|
|
UserNotificationPreferenceView.as_view(),
|
|
name='notification-preferences'
|
|
),
|
|
path('', NotificationListAPIView.as_view(), name='notifications-list'),
|
|
path('count/', NotificationCountView.as_view(), name='notifications-count'),
|
|
path(
|
|
'mark-notifications-unseen/<app_name>/',
|
|
MarkNotificationsUnseenAPIView.as_view(),
|
|
name='mark-notifications-unseen'
|
|
),
|
|
|
|
]
|
|
|
|
urlpatterns += router.urls
|