Skip to content

[WEB-3186] chore: added endpoints for issue and issue description versioning#6434

Merged
pushya22 merged 2 commits intopreviewfrom
chore-issue-version-endpoints
Jan 21, 2025
Merged

[WEB-3186] chore: added endpoints for issue and issue description versioning#6434
pushya22 merged 2 commits intopreviewfrom
chore-issue-version-endpoints

Conversation

@gurusainath
Copy link
Member

@gurusainath gurusainath commented Jan 21, 2025

Description

  • Implemented new endpoints to manage issue versions and issue description versions.
  • These endpoints enable tracking and managing changes to issues and their descriptions over time.

Type of Change

  • Feature (non-breaking change which adds functionality)

References

[WEB-3186]

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for issue version tracking
    • Introduced versioning capabilities for issue descriptions
    • Implemented new API endpoints for retrieving issue and description version history
  • Improvements

    • Enhanced data retrieval with pagination and timezone-aware datetime handling
    • Added role-based access controls for version endpoints

The update provides more granular tracking and retrieval of issue and description version information across workspaces and projects.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2025

Walkthrough

This pull request introduces new serializers, URL patterns, and API endpoints for managing issue versions and description versions in the Plane application. The changes enable tracking and retrieving historical versions of issues and their descriptions, providing a comprehensive versioning mechanism. The implementation includes serialization classes, URL routing, and view endpoints that support listing and retrieving specific versions with pagination and timezone-aware processing.

Changes

File Change Summary
apiserver/plane/app/serializers/__init__.py Added two new serializers: IssueVersionDetailSerializer and IssueDescriptionVersionDetailSerializer
apiserver/plane/app/serializers/issue.py Implemented detailed serializer classes for issue versions and description versions
apiserver/plane/app/urls/issue.py Added four new URL patterns for issue and description version endpoints
apiserver/plane/app/views/__init__.py Imported new version-related endpoints: IssueVersionEndpoint and IssueDescriptionVersionEndpoint
apiserver/plane/app/views/issue/version.py Created new API endpoint classes for handling issue and description version retrieval

Possibly related PRs

Suggested Labels

🌟enhancement

Suggested Reviewers

  • sriramveeraghanta
  • rahulramesha
  • pablohashescobar

Poem

🐰 Versioning Rabbit's Delight

In Plane's digital garden so bright,
Issues dance with version's might,
Tracking changes, day and night,
A rabbit's code takes playful flight! 🚀

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
apiserver/plane/app/views/issue/version.py (1)

17-66: Refactor common code to reduce duplication.

Both IssueVersionEndpoint and IssueDescriptionVersionEndpoint have similar implementations in their process_paginated_result and get methods. Consider refactoring the common logic into a base class or utility functions to reduce code duplication and improve maintainability.

Also applies to: 69-118

apiserver/plane/app/urls/issue.py (1)

261-280: Update the URL pattern names to be more specific.

The URL pattern names should be more descriptive and specific to their functionality instead of using the generic "page-versions" for all endpoints.

Consider using these names instead:

-        name="page-versions",
+        name="issue-versions",
-        name="page-versions",
+        name="issue-version-detail",
-        name="page-versions",
+        name="issue-description-versions",
-        name="page-versions",
+        name="issue-description-version-detail",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22836ea and ca07cdd.

📒 Files selected for processing (5)
  • apiserver/plane/app/serializers/__init__.py (1 hunks)
  • apiserver/plane/app/serializers/issue.py (2 hunks)
  • apiserver/plane/app/urls/issue.py (2 hunks)
  • apiserver/plane/app/views/__init__.py (1 hunks)
  • apiserver/plane/app/views/issue/version.py (1 hunks)
🔇 Additional comments (5)
apiserver/plane/app/views/issue/version.py (1)

1-15: Review of imports and initial setup.

Imports and initial setup look correct and necessary for the functionality of the endpoints.

apiserver/plane/app/serializers/__init__.py (1)

75-76: Added new serializers correctly.

The IssueVersionDetailSerializer and IssueDescriptionVersionDetailSerializer are correctly imported, enabling their use in the views.

apiserver/plane/app/views/__init__.py (1)

144-145: Imported new endpoints successfully.

The IssueVersionEndpoint and IssueDescriptionVersionEndpoint are properly imported from .issue.version, integrating the new endpoints into the application.

apiserver/plane/app/urls/issue.py (1)

27-28: LGTM! The URL structure follows RESTful conventions.

The URL patterns are well-structured and follow REST conventions for versioning resources. The use of UUIDs for identification and the hierarchical structure (workspace -> project -> issue -> version) is appropriate.

Also applies to: 261-280

apiserver/plane/app/serializers/issue.py (1)

674-732: LGTM! Well-structured serializers with appropriate field definitions.

Both serializers are well-implemented with:

  • Proper inheritance from BaseSerializer
  • Comprehensive field lists
  • Appropriate read-only fields for maintaining data integrity

Comment on lines +31 to +33
issue_version = IssueVersion.objects.get(
workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle exceptions when retrieving objects with .get().

The IssueVersion.objects.get() method will raise an exception if the object does not exist, leading to a server error. To prevent this, consider handling the IssueVersion.DoesNotExist exception and returning an appropriate 404 response.

Apply this fix:

 def get(self, request, slug, project_id, issue_id, pk=None):
     if pk:
-        issue_version = IssueVersion.objects.get(
+        try:
+            issue_version = IssueVersion.objects.get(
                 workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
+            )
+        except IssueVersion.DoesNotExist:
+            return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)

         serializer = IssueVersionDetailSerializer(issue_version)
         return Response(serializer.data, status=status.HTTP_200_OK)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
issue_version = IssueVersion.objects.get(
workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
)
def get(self, request, slug, project_id, issue_id, pk=None):
if pk:
try:
issue_version = IssueVersion.objects.get(
workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
)
except IssueVersion.DoesNotExist:
return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)
serializer = IssueVersionDetailSerializer(issue_version)
return Response(serializer.data, status=status.HTTP_200_OK)

Comment on lines +83 to +85
issue_description_version = IssueDescriptionVersion.objects.get(
workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle exceptions when retrieving objects with .get().

The IssueDescriptionVersion.objects.get() method will raise an exception if the object does not exist, leading to a server error. To prevent this, consider handling the IssueDescriptionVersion.DoesNotExist exception and returning an appropriate 404 response.

Apply this fix:

 def get(self, request, slug, project_id, issue_id, pk=None):
     if pk:
-        issue_description_version = IssueDescriptionVersion.objects.get(
+        try:
+            issue_description_version = IssueDescriptionVersion.objects.get(
                 workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
+            )
+        except IssueDescriptionVersion.DoesNotExist:
+            return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)

         serializer = IssueDescriptionVersionDetailSerializer(
             issue_description_version

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +674 to +711
class IssueVersionDetailSerializer(BaseSerializer):
class Meta:
model = IssueVersion
fields = [
"id",
"workspace",
"project",
"issue",
"parent",
"state",
"estimate_point",
"name",
"priority",
"start_date",
"target_date",
"assignees",
"sequence_id",
"labels",
"sort_order",
"completed_at",
"archived_at",
"is_draft",
"external_source",
"external_id",
"type",
"cycle",
"modules",
"meta",
"name",
"last_saved_at",
"owned_by",
"created_at",
"updated_at",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove the duplicate 'name' field.

The name field appears twice in the fields list at lines 685 and 702.

Apply this diff to remove the duplicate:

             "type",
             "cycle",
             "modules",
             "meta",
-            "name",
             "last_saved_at",
             "owned_by",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class IssueVersionDetailSerializer(BaseSerializer):
class Meta:
model = IssueVersion
fields = [
"id",
"workspace",
"project",
"issue",
"parent",
"state",
"estimate_point",
"name",
"priority",
"start_date",
"target_date",
"assignees",
"sequence_id",
"labels",
"sort_order",
"completed_at",
"archived_at",
"is_draft",
"external_source",
"external_id",
"type",
"cycle",
"modules",
"meta",
"name",
"last_saved_at",
"owned_by",
"created_at",
"updated_at",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]
class IssueVersionDetailSerializer(BaseSerializer):
class Meta:
model = IssueVersion
fields = [
"id",
"workspace",
"project",
"issue",
"parent",
"state",
"estimate_point",
"name",
"priority",
"start_date",
"target_date",
"assignees",
"sequence_id",
"labels",
"sort_order",
"completed_at",
"archived_at",
"is_draft",
"external_source",
"external_id",
"type",
"cycle",
"modules",
"meta",
"last_saved_at",
"owned_by",
"created_at",
"updated_at",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
apiserver/plane/app/views/issue/version.py (2)

18-26: Reduce code duplication by extracting common functionality.

Both endpoint classes have identical process_paginated_result methods. Consider extracting this into a mixin or base class to follow DRY principles.

+class VersionEndpointMixin:
+    def process_paginated_result(self, fields, results, timezone):
+        paginated_data = results.values(*fields)
+
+        datetime_fields = ["created_at", "updated_at"]
+        paginated_data = user_timezone_converter(
+            paginated_data, datetime_fields, timezone
+        )
+
+        return paginated_data
+
-class IssueVersionEndpoint(BaseAPIView):
+class IssueVersionEndpoint(BaseAPIView, VersionEndpointMixin):
-    def process_paginated_result(self, fields, results, timezone):
-        paginated_data = results.values(*fields)
-
-        datetime_fields = ["created_at", "updated_at"]
-        paginated_data = user_timezone_converter(
-            paginated_data, datetime_fields, timezone
-        )
-
-        return paginated_data

Also applies to: 70-78


40-51: Extract common required fields into a constant.

Both endpoint classes use identical required fields. Consider extracting these into a shared constant to improve maintainability.

+VERSION_REQUIRED_FIELDS = [
+    "id",
+    "workspace",
+    "project",
+    "issue",
+    "last_saved_at",
+    "owned_by",
+    "created_at",
+    "updated_at",
+    "created_by",
+    "updated_by",
+]

class IssueVersionEndpoint(BaseAPIView, VersionEndpointMixin):
    def get(self, request, slug, project_id, issue_id, pk=None):
        ...
-        required_fields = [
-            "id",
-            "workspace",
-            "project",
-            "issue",
-            "last_saved_at",
-            "owned_by",
-            "created_at",
-            "updated_at",
-            "created_by",
-            "updated_by",
-        ]
+        required_fields = VERSION_REQUIRED_FIELDS

Also applies to: 94-105

apiserver/plane/app/serializers/issue.py (1)

713-732: Improve code organization and documentation.

The serializer would benefit from:

  1. Adding a class-level docstring to explain its purpose
  2. Organizing fields into logical groups for better readability

Apply this diff to improve the code:

 class IssueDescriptionVersionDetailSerializer(BaseSerializer):
+    """Serializer for IssueDescriptionVersion model to track historical versions of issue descriptions."""
+
     class Meta:
         model = IssueDescriptionVersion
         fields = [
             "id",
             # Relationship fields
             "workspace",
             "project",
             "issue",
             # Description fields
             "description_binary",
             "description_html",
             "description_stripped",
             "description_json",
             # Timestamps
             "last_saved_at",
             "created_at",
             "updated_at",
             # Ownership
             "owned_by",
             "created_by",
             "updated_by",
         ]
         read_only_fields = ["workspace", "project", "issue"]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22836ea and ca07cdd.

📒 Files selected for processing (5)
  • apiserver/plane/app/serializers/__init__.py (1 hunks)
  • apiserver/plane/app/serializers/issue.py (2 hunks)
  • apiserver/plane/app/urls/issue.py (2 hunks)
  • apiserver/plane/app/views/__init__.py (1 hunks)
  • apiserver/plane/app/views/issue/version.py (1 hunks)
🔇 Additional comments (3)
apiserver/plane/app/views/__init__.py (1)

144-145: LGTM!

The imports are correctly placed and follow the existing pattern.

apiserver/plane/app/serializers/__init__.py (1)

75-76: LGTM!

The serializer imports are correctly placed within the issue-related imports section.

apiserver/plane/app/serializers/issue.py (1)

36-37: LGTM! Model imports are properly organized.

The new model imports are correctly placed within the existing model imports section.

Comment on lines +31 to +33
issue_version = IssueVersion.objects.get(
workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling for non-existent objects.

The .get() calls could raise DoesNotExist exceptions. Consider adding proper error handling.

+from django.core.exceptions import ObjectDoesNotExist
+from rest_framework import status

 class IssueVersionEndpoint(BaseAPIView):
     def get(self, request, slug, project_id, issue_id, pk=None):
         if pk:
-            issue_version = IssueVersion.objects.get(
-                workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
-            )
+            try:
+                issue_version = IssueVersion.objects.get(
+                    workspace__slug=slug, project_id=project_id, issue_id=issue_id, pk=pk
+                )
+            except ObjectDoesNotExist:
+                return Response(
+                    {"error": "Issue version not found"}, 
+                    status=status.HTTP_404_NOT_FOUND
+                )

Also applies to: 83-85

Comment on lines +261 to +280
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/",
IssueVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/<uuid:pk>/",
IssueVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/",
IssueDescriptionVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/<uuid:pk>/",
IssueDescriptionVersionEndpoint.as_view(),
name="page-versions",
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix inconsistent URL pattern names.

The URL pattern names "page-versions" seem incorrect for issue-related endpoints. Consider using more appropriate names like "issue-versions" and "issue-description-versions".

 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/",
     IssueVersionEndpoint.as_view(),
-    name="page-versions",
+    name="issue-versions",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/<uuid:pk>/",
     IssueVersionEndpoint.as_view(),
-    name="page-versions",
+    name="issue-version-detail",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/",
     IssueDescriptionVersionEndpoint.as_view(),
-    name="page-versions",
+    name="issue-description-versions",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/<uuid:pk>/",
     IssueDescriptionVersionEndpoint.as_view(),
-    name="page-versions",
+    name="issue-description-version-detail",
 ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/",
IssueVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/<uuid:pk>/",
IssueVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/",
IssueDescriptionVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/<uuid:pk>/",
IssueDescriptionVersionEndpoint.as_view(),
name="page-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/",
IssueVersionEndpoint.as_view(),
name="issue-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/versions/<uuid:pk>/",
IssueVersionEndpoint.as_view(),
name="issue-version-detail",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/",
IssueDescriptionVersionEndpoint.as_view(),
name="issue-description-versions",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/issues/<uuid:issue_id>/description-versions/<uuid:pk>/",
IssueDescriptionVersionEndpoint.as_view(),
name="issue-description-version-detail",
),

Comment on lines +674 to +711
class IssueVersionDetailSerializer(BaseSerializer):
class Meta:
model = IssueVersion
fields = [
"id",
"workspace",
"project",
"issue",
"parent",
"state",
"estimate_point",
"name",
"priority",
"start_date",
"target_date",
"assignees",
"sequence_id",
"labels",
"sort_order",
"completed_at",
"archived_at",
"is_draft",
"external_source",
"external_id",
"type",
"cycle",
"modules",
"meta",
"name",
"last_saved_at",
"owned_by",
"created_at",
"updated_at",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix duplicate field and improve code organization.

The serializer has the following issues:

  1. The field 'name' is duplicated (lines 685 and 702)
  2. Missing class-level docstring to explain the serializer's purpose
  3. Related fields could be grouped together for better readability

Apply this diff to fix the issues:

 class IssueVersionDetailSerializer(BaseSerializer):
+    """Serializer for IssueVersion model to track historical versions of issues."""
+
     class Meta:
         model = IssueVersion
         fields = [
             "id",
             # Relationship fields
             "workspace",
             "project",
             "issue",
             "parent",
             "state",
             "cycle",
             "modules",
             # Core issue fields
             "name",
             "priority",
             "estimate_point",
             "sequence_id",
             "sort_order",
             # Date fields
             "start_date",
             "target_date",
             "completed_at",
             "archived_at",
             "last_saved_at",
             "created_at",
             "updated_at",
             # Relationship arrays
             "assignees",
             "labels",
             # Status flags
             "is_draft",
             # External references
             "external_source",
             "external_id",
             "type",
             # Additional data
             "meta",
             # Ownership
             "owned_by",
             "created_by",
             "updated_by",
-            "name",  # Remove duplicate field
         ]
         read_only_fields = ["workspace", "project", "issue"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class IssueVersionDetailSerializer(BaseSerializer):
class Meta:
model = IssueVersion
fields = [
"id",
"workspace",
"project",
"issue",
"parent",
"state",
"estimate_point",
"name",
"priority",
"start_date",
"target_date",
"assignees",
"sequence_id",
"labels",
"sort_order",
"completed_at",
"archived_at",
"is_draft",
"external_source",
"external_id",
"type",
"cycle",
"modules",
"meta",
"name",
"last_saved_at",
"owned_by",
"created_at",
"updated_at",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]
class IssueVersionDetailSerializer(BaseSerializer):
"""Serializer for IssueVersion model to track historical versions of issues."""
class Meta:
model = IssueVersion
fields = [
"id",
# Relationship fields
"workspace",
"project",
"issue",
"parent",
"state",
"cycle",
"modules",
# Core issue fields
"name",
"priority",
"estimate_point",
"sequence_id",
"sort_order",
# Date fields
"start_date",
"target_date",
"completed_at",
"archived_at",
"last_saved_at",
"created_at",
"updated_at",
# Relationship arrays
"assignees",
"labels",
# Status flags
"is_draft",
# External references
"external_source",
"external_id",
"type",
# Additional data
"meta",
# Ownership
"owned_by",
"created_by",
"updated_by",
]
read_only_fields = ["workspace", "project", "issue"]

@pushya22 pushya22 merged commit b611f51 into preview Jan 21, 2025
12 of 14 checks passed
@pushya22 pushya22 deleted the chore-issue-version-endpoints branch January 21, 2025 15:04
@coderabbitai coderabbitai bot mentioned this pull request Feb 5, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants