mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: update module detail serializer
This commit is contained in:
parent
f89e415bca
commit
98cfc50dca
@ -72,6 +72,7 @@ from .issue import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from .module import (
|
from .module import (
|
||||||
|
ModuleDetailSerializer,
|
||||||
ModuleWriteSerializer,
|
ModuleWriteSerializer,
|
||||||
ModuleSerializer,
|
ModuleSerializer,
|
||||||
ModuleIssueSerializer,
|
ModuleIssueSerializer,
|
||||||
|
@ -142,7 +142,6 @@ class ModuleIssueSerializer(BaseSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class ModuleLinkSerializer(BaseSerializer):
|
class ModuleLinkSerializer(BaseSerializer):
|
||||||
created_by_detail = UserLiteSerializer(read_only=True, source="created_by")
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ModuleLink
|
model = ModuleLink
|
||||||
@ -216,6 +215,15 @@ class ModuleSerializer(DynamicBaseSerializer):
|
|||||||
read_only_fields = fields
|
read_only_fields = fields
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ModuleDetailSerializer(ModuleSerializer):
|
||||||
|
|
||||||
|
link_module = ModuleLinkSerializer(read_only=True, many=True)
|
||||||
|
|
||||||
|
class Meta(ModuleSerializer.Meta):
|
||||||
|
fields = ModuleSerializer.Meta.fields + ['link_module']
|
||||||
|
|
||||||
|
|
||||||
class ModuleFavoriteSerializer(BaseSerializer):
|
class ModuleFavoriteSerializer(BaseSerializer):
|
||||||
module_detail = ModuleFlatSerializer(source="module", read_only=True)
|
module_detail = ModuleFlatSerializer(source="module", read_only=True)
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ from plane.app.serializers import (
|
|||||||
ModuleFavoriteSerializer,
|
ModuleFavoriteSerializer,
|
||||||
IssueSerializer,
|
IssueSerializer,
|
||||||
ModuleUserPropertiesSerializer,
|
ModuleUserPropertiesSerializer,
|
||||||
|
ModuleDetailSerializer,
|
||||||
)
|
)
|
||||||
from plane.app.permissions import (
|
from plane.app.permissions import (
|
||||||
ProjectEntityPermission,
|
ProjectEntityPermission,
|
||||||
@ -337,35 +338,7 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
.order_by("label_name")
|
.order_by("label_name")
|
||||||
)
|
)
|
||||||
|
|
||||||
data = queryset.values( # Required fields
|
data = ModuleDetailSerializer(queryset.first()).data
|
||||||
"id",
|
|
||||||
"workspace_id",
|
|
||||||
"project_id",
|
|
||||||
# Model fields
|
|
||||||
"name",
|
|
||||||
"description",
|
|
||||||
"description_text",
|
|
||||||
"description_html",
|
|
||||||
"start_date",
|
|
||||||
"target_date",
|
|
||||||
"status",
|
|
||||||
"lead_id",
|
|
||||||
"member_ids",
|
|
||||||
"view_props",
|
|
||||||
"sort_order",
|
|
||||||
"external_source",
|
|
||||||
"external_id",
|
|
||||||
# computed fields
|
|
||||||
"is_favorite",
|
|
||||||
"total_issues",
|
|
||||||
"cancelled_issues",
|
|
||||||
"completed_issues",
|
|
||||||
"started_issues",
|
|
||||||
"unstarted_issues",
|
|
||||||
"backlog_issues",
|
|
||||||
"created_at",
|
|
||||||
"updated_at",
|
|
||||||
).first()
|
|
||||||
data["distribution"] = {
|
data["distribution"] = {
|
||||||
"assignees": assignee_distribution,
|
"assignees": assignee_distribution,
|
||||||
"labels": label_distribution,
|
"labels": label_distribution,
|
||||||
|
Loading…
Reference in New Issue
Block a user