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.
44 lines
1.3 KiB
Python
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,
|
|
}
|