feat: replace email flows with in-app notifications

Add recipient notification detail and filtering, a queued admin composer, and contextual automatic titles. Retire email delivery, obsolete auth routes, newsletter data, and related templates and settings.
This commit is contained in:
2026-09-26 12:23:10 +03:30
parent b706a2d10a
commit 3ec28638d1
54 changed files with 787 additions and 4843 deletions

View File

@@ -1,7 +1,7 @@
"""Schemas for communications-related endpoints."""
from datetime import datetime
from typing import Optional
from typing import Literal, Optional
from ninja import ModelSchema, Schema
@@ -12,10 +12,6 @@ from apps.communications.models import Announcement, PushNotificationDevice
class AnnouncementSchema(ModelSchema):
author: AuthorSchema
content_html: str
deliver_in_app: bool
deliver_sms: bool
in_app_sent: bool
sms_sent: bool
class Config:
model = Announcement
@@ -27,7 +23,6 @@ class AnnouncementSchema(ModelSchema):
"priority",
"is_published",
"publish_date",
"target_audience",
"created_at",
"updated_at",
]
@@ -36,23 +31,6 @@ class AnnouncementSchema(ModelSchema):
def resolve_content_html(obj):
return obj.content_html
@staticmethod
def resolve_deliver_in_app(obj):
return obj.send_email
@staticmethod
def resolve_deliver_sms(obj):
return obj.send_push
@staticmethod
def resolve_in_app_sent(obj):
return obj.email_sent
@staticmethod
def resolve_sms_sent(obj):
return obj.push_sent
class AnnouncementListSchema(Schema):
id: int
title: str
@@ -62,34 +40,25 @@ class AnnouncementListSchema(Schema):
author: AuthorSchema
is_published: bool
publish_date: Optional[datetime] = None
target_audience: str
deliver_in_app: bool
deliver_sms: bool
created_at: datetime
class AnnouncementCreateSchema(Schema):
title: str
content: str
announcement_type: str = "general"
priority: str = "normal"
target_audience: str = "all"
announcement_type: Literal["general", "event", "academic", "urgent"] = "general"
priority: Literal["low", "normal", "high", "urgent"] = "normal"
is_published: bool = False
publish_date: Optional[datetime] = None
deliver_in_app: bool = True
deliver_sms: bool = False
class AnnouncementUpdateSchema(Schema):
title: Optional[str] = None
content: Optional[str] = None
announcement_type: Optional[str] = None
priority: Optional[str] = None
target_audience: Optional[str] = None
announcement_type: Optional[Literal["general", "event", "academic", "urgent"]] = None
priority: Optional[Literal["low", "normal", "high", "urgent"]] = None
is_published: Optional[bool] = None
publish_date: Optional[datetime] = None
deliver_in_app: Optional[bool] = None
deliver_sms: Optional[bool] = None
class PushDeviceSchema(ModelSchema):
@@ -109,13 +78,6 @@ class PushDeviceUpdateSchema(Schema):
is_active: bool
class PushNotificationSchema(Schema):
title: str
body: str
data: Optional[dict] = None
target_audience: str = "all"
class MessageResponseSchema(Schema):
message: str
success: bool = True
@@ -126,5 +88,3 @@ class AnnouncementStatsSchema(Schema):
published_announcements: int
draft_announcements: int
urgent_announcements: int
in_app_sent_count: int
sms_sent_count: int