schon/payments/docs/drf/viewsets.py
Egor fureunoir Gorbunov c0fcde4bb4 Features: 1) Introduced extend_schema for multiple viewsets to improve OpenAPI documentation; 2) Added detailed schema definitions for blog and payments viewsets using drf-spectacular; 3) Transitioned download_digital_asset functionality to class-based DownloadDigitalAssetView for better modularity.
Fixes: 1) Standardized error responses in `DownloadDigitalAssetView`.

Extra: Improved maintainability by refactoring serializers and schema definitions into modular components; updated API URLs to use new class-based view.
2025-10-26 18:44:19 +03:00

17 lines
618 B
Python

from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import extend_schema
from rest_framework import status
from core.docs.drf import BASE_ERRORS
from payments.serializers import TransactionSerializer
TRANSACTION_SCHEMA = {
"list": extend_schema(
summary=_("list all transactions (read-only)"),
responses={status.HTTP_200_OK: TransactionSerializer(many=True), **BASE_ERRORS},
),
"retrieve": extend_schema(
summary=_("retrieve a single transaction (read-only)"),
responses={status.HTTP_200_OK: TransactionSerializer(), **BASE_ERRORS},
),
}