refactor(notifications): align app structure with backend conventions
This commit is contained in:
1
apps/notifications/api/__init__.py
Normal file
1
apps/notifications/api/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
from apps.notifications import views
|
from apps.notifications.api import views
|
||||||
|
|
||||||
router = DefaultRouter()
|
router = DefaultRouter()
|
||||||
router.register("box", views.NotificationListViewSet, basename="box")
|
router.register("box", views.NotificationListViewSet, basename="box")
|
||||||
@@ -13,7 +13,7 @@ from rest_framework.permissions import IsAuthenticated
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
from apps.notifications.serializers import (
|
from apps.notifications.api.serializers import (
|
||||||
NotificationDeleteResponseSerializer,
|
NotificationDeleteResponseSerializer,
|
||||||
NotificationListResponseSerializer,
|
NotificationListResponseSerializer,
|
||||||
NotificationMarkAllReadResponseSerializer,
|
NotificationMarkAllReadResponseSerializer,
|
||||||
23
apps/notifications/services/__init__.py
Normal file
23
apps/notifications/services/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from apps.notifications.services.membership_events import (
|
||||||
|
notify_project_membership_added,
|
||||||
|
notify_project_membership_deactivated,
|
||||||
|
notify_project_membership_removed,
|
||||||
|
notify_project_membership_role_changed,
|
||||||
|
notify_workspace_membership_added,
|
||||||
|
notify_workspace_membership_deactivated,
|
||||||
|
notify_workspace_membership_removed,
|
||||||
|
notify_workspace_membership_role_changed,
|
||||||
|
)
|
||||||
|
from apps.notifications.services.store import RedisNotificationStore
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"RedisNotificationStore",
|
||||||
|
"notify_workspace_membership_added",
|
||||||
|
"notify_workspace_membership_role_changed",
|
||||||
|
"notify_workspace_membership_deactivated",
|
||||||
|
"notify_workspace_membership_removed",
|
||||||
|
"notify_project_membership_added",
|
||||||
|
"notify_project_membership_role_changed",
|
||||||
|
"notify_project_membership_deactivated",
|
||||||
|
"notify_project_membership_removed",
|
||||||
|
]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from apps.notifications.services import RedisNotificationStore
|
from apps.notifications.services.store import RedisNotificationStore
|
||||||
|
|
||||||
|
|
||||||
def _actor_name(actor) -> str:
|
def _actor_name(actor) -> str:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
from apps.notifications import services
|
from apps.notifications.services import store as services
|
||||||
from apps.notifications.services import RedisNotificationStore
|
from apps.notifications.services import RedisNotificationStore
|
||||||
from apps.notifications.tests.test_services import FakeRedis
|
from apps.notifications.tests.test_services import FakeRedis
|
||||||
from apps.projects.models import Project, ProjectMembership
|
from apps.projects.models import Project, ProjectMembership
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from collections import defaultdict
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from apps.notifications import services
|
from apps.notifications.services import store as services
|
||||||
from apps.notifications.services import RedisNotificationStore
|
from apps.notifications.services import RedisNotificationStore
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import pytest
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
from apps.notifications import services, views
|
from apps.notifications.api import views
|
||||||
|
from apps.notifications.services import store as services
|
||||||
from apps.notifications.services import RedisNotificationStore
|
from apps.notifications.services import RedisNotificationStore
|
||||||
from apps.notifications.tests.test_services import FakePubSub, FakeRedis
|
from apps.notifications.tests.test_services import FakePubSub, FakeRedis
|
||||||
from apps.users.models import User
|
from apps.users.models import User
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from django_filters.rest_framework import DjangoFilterBackend
|
|||||||
|
|
||||||
from core.paginations.limit_offset import CustomLimitOffsetPagination
|
from core.paginations.limit_offset import CustomLimitOffsetPagination
|
||||||
|
|
||||||
from apps.notifications.membership_events import (
|
from apps.notifications.services import (
|
||||||
notify_project_membership_added,
|
notify_project_membership_added,
|
||||||
notify_project_membership_deactivated,
|
notify_project_membership_deactivated,
|
||||||
notify_project_membership_removed,
|
notify_project_membership_removed,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from apps.notifications.membership_events import notify_workspace_membership_added
|
from apps.notifications.services import notify_workspace_membership_added
|
||||||
from apps.users.models import User
|
from apps.users.models import User
|
||||||
from core.serializers.base import BaseModelSerializer
|
from core.serializers.base import BaseModelSerializer
|
||||||
from apps.workspaces.models import Workspace, WorkspaceMembership
|
from apps.workspaces.models import Workspace, WorkspaceMembership
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from django_filters.rest_framework import DjangoFilterBackend
|
|||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
|
||||||
from apps.notifications.membership_events import (
|
from apps.notifications.services import (
|
||||||
notify_workspace_membership_added,
|
notify_workspace_membership_added,
|
||||||
notify_workspace_membership_deactivated,
|
notify_workspace_membership_deactivated,
|
||||||
notify_workspace_membership_removed,
|
notify_workspace_membership_removed,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ urlpatterns = [
|
|||||||
path('api/', include('apps.projects.api.urls'), name="projects"),
|
path('api/', include('apps.projects.api.urls'), name="projects"),
|
||||||
path('api/', include('apps.tags.api.urls'), name="tags"),
|
path('api/', include('apps.tags.api.urls'), name="tags"),
|
||||||
path('api/', include('apps.time_entries.api.urls'), name="time_entries"),
|
path('api/', include('apps.time_entries.api.urls'), name="time_entries"),
|
||||||
path("api/notifications/", include("apps.notifications.urls"), name="notifications"),
|
path("api/notifications/", include("apps.notifications.api.urls"), name="notifications"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|||||||
Reference in New Issue
Block a user