mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
3036014ea2
* refactor: add anotations in queryset to return sub_issues_count * refactor: add sub issue count in modules cycles and my issues endpoint
38 lines
866 B
Python
38 lines
866 B
Python
# Third party imports
|
|
from rest_framework import serializers
|
|
|
|
# Module imports
|
|
from .base import BaseSerializer
|
|
from .user import UserLiteSerializer
|
|
from .issue import IssueStateSerializer
|
|
from plane.db.models import Cycle, CycleIssue
|
|
|
|
|
|
class CycleSerializer(BaseSerializer):
|
|
|
|
owned_by = UserLiteSerializer(read_only=True)
|
|
|
|
class Meta:
|
|
model = Cycle
|
|
fields = "__all__"
|
|
read_only_fields = [
|
|
"workspace",
|
|
"project",
|
|
"owned_by",
|
|
]
|
|
|
|
|
|
class CycleIssueSerializer(BaseSerializer):
|
|
|
|
issue_detail = IssueStateSerializer(read_only=True, source="issue")
|
|
sub_issues_count = serializers.IntegerField(read_only=True)
|
|
|
|
class Meta:
|
|
model = CycleIssue
|
|
fields = "__all__"
|
|
read_only_fields = [
|
|
"workspace",
|
|
"project",
|
|
"cycle",
|
|
]
|