refactor(notifications): align app structure with backend conventions

This commit is contained in:
2026-04-25 12:00:05 +03:30
parent 48bf4f5c19
commit 5f9d413a57
14 changed files with 35 additions and 10 deletions

View File

@@ -0,0 +1 @@

View File

@@ -1,7 +1,7 @@
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from apps.notifications import views
from apps.notifications.api import views
router = DefaultRouter()
router.register("box", views.NotificationListViewSet, basename="box")

View File

@@ -13,7 +13,7 @@ from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from apps.notifications.serializers import (
from apps.notifications.api.serializers import (
NotificationDeleteResponseSerializer,
NotificationListResponseSerializer,
NotificationMarkAllReadResponseSerializer,

View 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",
]

View File

@@ -1,4 +1,4 @@
from apps.notifications.services import RedisNotificationStore
from apps.notifications.services.store import RedisNotificationStore
def _actor_name(actor) -> str:

View File

@@ -1,7 +1,7 @@
import pytest
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.tests.test_services import FakeRedis
from apps.projects.models import Project, ProjectMembership

View File

@@ -3,7 +3,7 @@ from collections import defaultdict
import pytest
from apps.notifications import services
from apps.notifications.services import store as services
from apps.notifications.services import RedisNotificationStore

View File

@@ -6,7 +6,8 @@ import pytest
from django.utils import timezone
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.tests.test_services import FakePubSub, FakeRedis
from apps.users.models import User

View File

@@ -11,7 +11,7 @@ from django_filters.rest_framework import DjangoFilterBackend
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_deactivated,
notify_project_membership_removed,

View File

@@ -1,6 +1,6 @@
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 core.serializers.base import BaseModelSerializer
from apps.workspaces.models import Workspace, WorkspaceMembership

View File

@@ -7,7 +7,7 @@ from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAuthenticated
from apps.notifications.membership_events import (
from apps.notifications.services import (
notify_workspace_membership_added,
notify_workspace_membership_deactivated,
notify_workspace_membership_removed,