Files
PROJECT-CONTORL/openspec/changes/archive/2026-01-05-add-custom-fields/tasks.md
beabigegg 2d80a8384e feat: implement custom fields, gantt view, calendar view, and file encryption
- Custom Fields (FEAT-001):
  - CustomField and TaskCustomValue models with formula support
  - CRUD API for custom field management
  - Formula engine for calculated fields
  - Frontend: CustomFieldEditor, CustomFieldInput, ProjectSettings page
  - Task list API now includes custom_values
  - KanbanBoard displays custom field values

- Gantt View (FEAT-003):
  - TaskDependency model with FS/SS/FF/SF dependency types
  - Dependency CRUD API with cycle detection
  - start_date field added to tasks
  - GanttChart component with Frappe Gantt integration
  - Dependency type selector in UI

- Calendar View (FEAT-004):
  - CalendarView component with FullCalendar integration
  - Date range filtering API for tasks
  - Drag-and-drop date updates
  - View mode switching in Tasks page

- File Encryption (FEAT-010):
  - AES-256-GCM encryption service
  - EncryptionKey model with key rotation support
  - Admin API for key management
  - Encrypted upload/download for confidential projects

- Migrations: 011 (custom fields), 012 (encryption keys), 013 (task dependencies)
- Updated issues.md with completion status

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:39:12 +08:00

3.5 KiB
Raw Blame History

Tasks: Add Custom Fields

Backend Tasks

1. Create CustomField and TaskCustomValue models

  • Create backend/app/models/custom_field.py with CustomField model
  • Create backend/app/models/task_custom_value.py with TaskCustomValue model
  • Update backend/app/models/__init__.py to export new models
  • Create Alembic migration for new tables
  • 驗證: Migration 成功執行tables 建立正確

2. Create Custom Fields API endpoints

  • Create backend/app/api/custom_fields/router.py
  • Implement POST /api/projects/{project_id}/custom-fields - 新增欄位
  • Implement GET /api/projects/{project_id}/custom-fields - 列出欄位
  • Implement PUT /api/custom-fields/{field_id} - 更新欄位
  • Implement DELETE /api/custom-fields/{field_id} - 刪除欄位
  • Add permission checks (only project owner/manager can manage fields)
  • Register router in main.py
  • 驗證: API endpoints 可正常呼叫,權限檢查正確

3. Implement formula calculation engine

  • Create backend/app/services/formula_service.py
  • Implement formula parsing (extract field references)
  • Implement formula validation (detect circular references)
  • Implement formula calculation
  • Add unit tests for formula service
  • 驗證: 公式計算正確,循環引用被拒絕

4. Integrate custom values with Tasks API

  • Modify TaskCreate schema to accept custom_values
  • Modify TaskUpdate schema to accept custom_values
  • Modify TaskResponse schema to include custom_values
  • Update create_task endpoint to save custom values
  • Update update_task endpoint to save custom values
  • Update get_task endpoint to return custom values
  • Trigger formula recalculation on value change
  • 驗證: 任務 CRUD 包含自定義欄位值

5. Add backend tests

  • Test custom field CRUD operations
  • Test permission checks
  • Test formula calculation
  • Test task integration with custom values
  • 驗證: 所有測試通過 (20/20 tests passed)

Frontend Tasks

6. Create Custom Fields management UI

  • Create frontend/src/pages/ProjectSettings.tsx or extend existing
  • Create frontend/src/components/CustomFieldEditor.tsx - 欄位編輯表單
  • Create frontend/src/components/CustomFieldList.tsx - 欄位列表
  • Add custom fields API service in frontend/src/services/customFields.ts
  • 驗證: 可在專案設定中管理自定義欄位

7. Dynamic field rendering in Task forms

  • Create frontend/src/components/CustomFieldInput.tsx - 動態欄位輸入
  • Integrate into TaskDetailModal.tsx
  • Integrate into task creation form
  • Handle different field types (text, number, dropdown, date, person)
  • Display formula fields as read-only
  • 驗證: 任務表單正確顯示和儲存自定義欄位

8. Display custom fields in task views

  • Add custom field columns to List view
  • Display custom field values in Kanban cards (optional, configurable)
  • Add column visibility toggle for custom fields
  • 驗證: 自定義欄位值在各視角中正確顯示

Task Dependencies

[1] Models -> [2] API -> [4] Task Integration -> [5] Tests
                    \
                      [3] Formula Engine /

[6] Management UI -> [7] Task Forms -> [8] View Display
  • Tasks 1-5 (Backend) 可平行於 Tasks 6-8 (Frontend) 開發
  • Task 2 完成後 Task 6 可開始(需要 API
  • Task 4 完成後 Task 7 可開始(需要 Task API 支援 custom values