47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
from django_core.mixins import BaseViewSetMixin
|
|
from drf_spectacular.utils import extend_schema
|
|
from rest_framework.permissions import AllowAny
|
|
from rest_framework.viewsets import ReadOnlyModelViewSet
|
|
|
|
from core.apps.evaluation.models import CustomerModel, PropertyOwnerModel
|
|
from core.apps.evaluation.serializers.customer import (
|
|
CreateCustomerSerializer,
|
|
CreatePropertyOwnerSerializer,
|
|
ListCustomerSerializer,
|
|
ListPropertyOwnerSerializer,
|
|
RetrieveCustomerSerializer,
|
|
RetrievePropertyOwnerSerializer,
|
|
)
|
|
|
|
|
|
@extend_schema(tags=["Customer"])
|
|
class CustomerView(BaseViewSetMixin, ReadOnlyModelViewSet):
|
|
queryset = CustomerModel.objects.all()
|
|
serializer_class = ListCustomerSerializer
|
|
permission_classes = [AllowAny]
|
|
|
|
action_permission_classes = {}
|
|
action_serializer_class = {
|
|
"list": ListCustomerSerializer,
|
|
"retrieve": RetrieveCustomerSerializer,
|
|
"create": CreateCustomerSerializer,
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@extend_schema(tags=["PropertyOwner"])
|
|
class PropertyOwnerView(BaseViewSetMixin, ReadOnlyModelViewSet):
|
|
queryset = PropertyOwnerModel.objects.all()
|
|
serializer_class = ListPropertyOwnerSerializer
|
|
permission_classes = [AllowAny]
|
|
|
|
action_permission_classes = {}
|
|
action_serializer_class = {
|
|
"list": ListPropertyOwnerSerializer,
|
|
"retrieve": RetrievePropertyOwnerSerializer,
|
|
"create": CreatePropertyOwnerSerializer,
|
|
}
|
|
|