fix: part of functionality has taken from ContractView to ContractRelationsViewSet
This commit is contained in:
@@ -38,11 +38,9 @@ class ContractView(BaseViewSetMixin, ModelViewSet):
|
||||
action_permission_classes = { # type: ignore
|
||||
"list": [IsAdminUser],
|
||||
"retrieve": [IsAdminUser],
|
||||
"create": [IsAuthenticated],
|
||||
"create": [AllowAny],
|
||||
"update": [IsAdminUser],
|
||||
"destroy": [IsAdminUser],
|
||||
"list_file": [AllowAny],
|
||||
"list_owner": [AllowAny],
|
||||
}
|
||||
action_serializer_class = { # type: ignore
|
||||
"list": ListContractSerializer,
|
||||
@@ -50,8 +48,6 @@ class ContractView(BaseViewSetMixin, ModelViewSet):
|
||||
"create": CreateContractSerializer,
|
||||
"update": UpdateContractSerializer,
|
||||
"destroy": DestroyContractSerializer,
|
||||
"list_file": ListContractAttachedFileSerializer,
|
||||
"list_owner": RetrieveContractOwnerSerializer,
|
||||
}
|
||||
|
||||
def create(
|
||||
@@ -63,6 +59,20 @@ class ContractView(BaseViewSetMixin, ModelViewSet):
|
||||
#! TODO: checkout if user has access to create new contract.
|
||||
return super().create(request, *args, **kwargs) # type: ignore
|
||||
|
||||
|
||||
class ContractRelationsViewSet(BaseViewSetMixin, ModelViewSet):
|
||||
queryset = ContractModel.objects.all()
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
action_permission_classes = {
|
||||
"list_file": [AllowAny],
|
||||
"list_owner": [AllowAny],
|
||||
}
|
||||
action_serializer_class = { # type: ignore
|
||||
"list_file": ListContractAttachedFileSerializer,
|
||||
"list_owner": RetrieveContractOwnerSerializer,
|
||||
}
|
||||
|
||||
@extend_schema(
|
||||
summary="Get List Of Files",
|
||||
description="Get List Of Files"
|
||||
|
||||
Reference in New Issue
Block a user