schon/engine/vibes_auth/docs/drf/messaging.py
Egor fureunoir Gorbunov de0cb836fc Features: 1) Add rate-limiting decorators for multiple API methods across core viewsets; 2) Add translation support to messaging documentation.
Fixes: 1) Fix missing import for `send_message` moved to method scope in Telegram message handler; 2) Correct Swagger UI socket connection setting to `False`.

Extra: 1) Minor code cleanup and reformatting in viewsets and settings.
2025-11-12 11:50:51 +03:00

44 lines
1.3 KiB
Python

from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import OpenApiParameter
from engine.vibes_auth.messaging.serializers import (
StaffInboxEventSerializer,
ThreadOkResponseSerializer,
ThreadReplyRequestSerializer,
UserMessageRequestSerializer,
UserMessageResponseSerializer,
)
USER_MESSAGE_CONSUMER_SCHEMA = {
"tags": [
"messaging",
],
"type": "send",
"summary": _("User messages entrypoint"),
"description": _("Anonymous or authenticated non-staff users send messages. Also supports action=ping."),
"request": UserMessageRequestSerializer,
"responses": UserMessageResponseSerializer,
}
STAFF_INBOX_CONSUMER_SCHEMA = {
"tags": [
"messaging",
],
"type": "send",
"summary": _("Staff inbox control"),
"description": _("Staff-only actions: list_open, assign, reply, close, ping. Unified event payloads are emitted."),
"request": StaffInboxEventSerializer,
"responses": StaffInboxEventSerializer,
}
THREAD_CONSUMER_SCHEMA = {
"tags": [
"messaging",
],
"type": "send",
"summary": _("Per-thread staff channel"),
"description": _("Reply, close, and ping within a specific thread."),
"parameters": [OpenApiParameter(name="thread_id")],
"request": ThreadReplyRequestSerializer,
"responses": ThreadOkResponseSerializer,
}