schon/payments/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

21 lines
980 B
Python

from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import extend_schema_view
from rest_framework.viewsets import ReadOnlyModelViewSet
from core.permissions import EvibesPermission, IsOwner
from payments.serializers import TransactionSerializer
from payments.docs.drf.viewsets import TRANSACTION_SCHEMA
@extend_schema_view(**TRANSACTION_SCHEMA)
class TransactionViewSet(ReadOnlyModelViewSet): # type: ignore
__doc__ = _( # type: ignore [assignment]
"ViewSet for handling read-only operations on the Transaction model. "
"This class provides a read-only interface for interacting with transaction data. "
"It uses the TransactionSerializer for serializing and deserializing "
"the data. The class ensures that only authorized users, who meet specific "
"permissions, can access the transactions."
)
serializer_class = TransactionSerializer
permission_classes = (EvibesPermission, IsOwner)