Merge branch 'refactor/mobx-store' of github.com:makeplane/plane into refactor/mobx-store

This commit is contained in:
rahulramesha 2023-12-13 13:17:53 +05:30
commit 71381330b1
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@
from rest_framework import serializers
# Module imports
from .base import BaseSerializer
from .base import BaseSerializer, DynamicBaseSerializer
from .workspace import WorkspaceLiteSerializer
from .project import ProjectLiteSerializer
from plane.db.models import GlobalView, IssueView, IssueViewFavorite
@ -38,7 +38,7 @@ class GlobalViewSerializer(BaseSerializer):
return super().update(instance, validated_data)
class IssueViewSerializer(BaseSerializer):
class IssueViewSerializer(DynamicBaseSerializer):
is_favorite = serializers.BooleanField(read_only=True)
project_detail = ProjectLiteSerializer(source="project", read_only=True)
workspace_detail = WorkspaceLiteSerializer(source="workspace", read_only=True)

View File

@ -181,10 +181,7 @@ class GlobalViewIssuesViewSet(BaseViewSet):
issues = IssueLiteSerializer(issue_queryset, many=True, fields=fields if fields else None).data
issue_dict = {str(issue["id"]): issue for issue in issues}
return Response(
issue_dict,
status=status.HTTP_200_OK,
)
return Response(issue_dict, status=status.HTTP_200_OK)
class IssueViewViewSet(BaseViewSet):
@ -216,6 +213,13 @@ class IssueViewViewSet(BaseViewSet):
.order_by("-is_favorite", "name")
.distinct()
)
def list(self, request, slug, project_id):
queryset = self.get_queryset()
fields = [field for field in request.GET.get("fields", "").split(",") if field]
views = IssueViewSerializer(queryset, many=True, fields=fields if fields else None).data
views_dict = {str(view["id"]): view for view in views}
return Response(views_dict, status=status.HTTP_200_OK)
class IssueViewFavoriteViewSet(BaseViewSet):