forked from github/plane
feat: add cycle id and cycle details in issue list page
This commit is contained in:
parent
a5f071311d
commit
ddde7a7eea
@ -19,6 +19,8 @@ from plane.db.models import (
|
||||
IssueLabel,
|
||||
Label,
|
||||
IssueBlocker,
|
||||
Cycle,
|
||||
CycleIssue,
|
||||
)
|
||||
|
||||
|
||||
@ -302,6 +304,38 @@ class IssueAssigneeSerializer(BaseSerializer):
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class CycleBaseSerializer(BaseSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Cycle
|
||||
fields = "__all__"
|
||||
read_only_fields = [
|
||||
"workspace",
|
||||
"project",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
]
|
||||
|
||||
class IssueCycleDetailSerializer(BaseSerializer):
|
||||
|
||||
cycle_detail = CycleBaseSerializer(read_only=True, source="cycle")
|
||||
|
||||
class Meta:
|
||||
model = CycleIssue
|
||||
fields = "__all__"
|
||||
read_only_fields = [
|
||||
"workspace",
|
||||
"project",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
]
|
||||
|
||||
|
||||
|
||||
class IssueSerializer(BaseSerializer):
|
||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||
state_detail = StateSerializer(read_only=True, source="state")
|
||||
@ -310,6 +344,7 @@ class IssueSerializer(BaseSerializer):
|
||||
assignee_details = UserLiteSerializer(read_only=True, source="assignees", many=True)
|
||||
blocked_issues = BlockedIssueSerializer(read_only=True, many=True)
|
||||
blocker_issues = BlockerIssueSerializer(read_only=True, many=True)
|
||||
issue_cycle = IssueCycleDetailSerializer(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = Issue
|
||||
|
@ -36,6 +36,7 @@ from plane.db.models import (
|
||||
IssueProperty,
|
||||
Label,
|
||||
IssueBlocker,
|
||||
CycleIssue,
|
||||
)
|
||||
|
||||
|
||||
@ -89,6 +90,12 @@ class IssueViewSet(BaseViewSet):
|
||||
queryset=IssueBlocker.objects.select_related("block", "blocked_by"),
|
||||
)
|
||||
)
|
||||
.prefetch_related(
|
||||
Prefetch(
|
||||
"issue_cycle",
|
||||
queryset=CycleIssue.objects.select_related("cycle", "issue"),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
def grouper(self, issue, group_by):
|
||||
@ -384,7 +391,8 @@ class BulkDeleteIssuesEndpoint(BaseAPIView):
|
||||
issues.delete()
|
||||
|
||||
return Response(
|
||||
{"message": f"{total_issues} issues were deleted"}, status=status.HTTP_200_OK
|
||||
{"message": f"{total_issues} issues were deleted"},
|
||||
status=status.HTTP_200_OK,
|
||||
)
|
||||
except Exception as e:
|
||||
capture_exception(e)
|
||||
|
Loading…
Reference in New Issue
Block a user