plane icon indicating copy to clipboard operation
plane copied to clipboard

feat: add custom fields backend models, API, and tests

Open Vansh5632 opened this issue 2 days ago • 3 comments

Implement backend support for custom fields (work item properties) to allow projects to define and manage custom metadata for issues.

Description

  • Add IssueProperty and IssuePropertyValue models
  • Add migration 0113 with unique constraints
  • Add ViewSets for property CRUD and bulk operations
  • Add serializers with type-specific validation
  • Add 30 tests (8 model, 10 serializer, 12 API) - all passing
  • Support 6 field types: text, number, date, boolean, select, multi_select

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] Feature (non-breaking change which adds functionality)
  • [ ] Improvement (change that would cause existing functionality to not work as expected)
  • [ ] Code refactoring
  • [ ] Performance improvements
  • [ ] Documentation update

Test Scenarios

test cases are already addded

References

Linked to issue: #8157


[!NOTE] Adds backend support for project-defined custom fields and per-issue values with strict validation and atomic writes.

  • New models IssueProperty and IssuePropertyValue with migration 0113_custom_fields_issue_property.py (unique constraints, indexes)
  • Serializers: IssuePropertySerializer, IssuePropertyValueSerializer (type-validated: text/number/date/boolean/select/multi_select), plus IssuePropertyLiteSerializer
  • Issue flow integration: IssueCreateSerializer/update() handle custom_fields atomically; IssueDetailSerializer.to_representation() returns custom_fields
  • APIs/Views: IssuePropertyViewSet (project-level definitions CRUD), IssuePropertyValueViewSet (issue values list/create/update/delete), BulkIssuePropertyValueEndpoint (bulk get/set with transaction)
  • Routes added under apps/api/plane/api/urls/project.py and apps/api/plane/app/urls/issue.py for /properties/, /issues/<issue_id>/property-values/, and /issues/<issue_id>/custom-fields/
  • Tests: unit and contract coverage for models, serializers, endpoints, and soft-delete filtering

Written by Cursor Bugbot for commit 0a47750cb5d256c010545ec536b34f60bcd75a78. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Added project-level custom field definitions (create/edit/delete) and per-issue custom field values
    • Added bulk endpoints to set and retrieve multiple custom field values on an issue
    • Custom fields now surface in issue details and activity
  • Improvements

    • Stronger validation for custom field types/options and atomic (all-or-nothing) save behavior with clear error responses
  • Tests

    • Added unit and integration tests covering model, serializer, API, bulk ops, validation, and edge cases

✏️ Tip: You can customize this high-level summary in your review settings.

Vansh5632 avatar Dec 29 '25 13:12 Vansh5632