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

83 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Tasks: Add Custom Fields
## Backend Tasks
### 1. Create CustomField and TaskCustomValue models
- [x] Create `backend/app/models/custom_field.py` with CustomField model
- [x] Create `backend/app/models/task_custom_value.py` with TaskCustomValue model
- [x] Update `backend/app/models/__init__.py` to export new models
- [x] Create Alembic migration for new tables
- **驗證**: Migration 成功執行tables 建立正確
### 2. Create Custom Fields API endpoints
- [x] Create `backend/app/api/custom_fields/router.py`
- [x] Implement `POST /api/projects/{project_id}/custom-fields` - 新增欄位
- [x] Implement `GET /api/projects/{project_id}/custom-fields` - 列出欄位
- [x] Implement `PUT /api/custom-fields/{field_id}` - 更新欄位
- [x] Implement `DELETE /api/custom-fields/{field_id}` - 刪除欄位
- [x] Add permission checks (only project owner/manager can manage fields)
- [x] Register router in main.py
- **驗證**: API endpoints 可正常呼叫,權限檢查正確
### 3. Implement formula calculation engine
- [x] Create `backend/app/services/formula_service.py`
- [x] Implement formula parsing (extract field references)
- [x] Implement formula validation (detect circular references)
- [x] Implement formula calculation
- [x] Add unit tests for formula service
- **驗證**: 公式計算正確,循環引用被拒絕
### 4. Integrate custom values with Tasks API
- [x] Modify `TaskCreate` schema to accept `custom_values`
- [x] Modify `TaskUpdate` schema to accept `custom_values`
- [x] Modify `TaskResponse` schema to include `custom_values`
- [x] Update `create_task` endpoint to save custom values
- [x] Update `update_task` endpoint to save custom values
- [x] Update `get_task` endpoint to return custom values
- [x] Trigger formula recalculation on value change
- **驗證**: 任務 CRUD 包含自定義欄位值
### 5. Add backend tests
- [x] Test custom field CRUD operations
- [x] Test permission checks
- [x] Test formula calculation
- [x] Test task integration with custom values
- **驗證**: 所有測試通過 (20/20 tests passed)
## Frontend Tasks
### 6. Create Custom Fields management UI
- [x] Create `frontend/src/pages/ProjectSettings.tsx` or extend existing
- [x] Create `frontend/src/components/CustomFieldEditor.tsx` - 欄位編輯表單
- [x] Create `frontend/src/components/CustomFieldList.tsx` - 欄位列表
- [x] Add custom fields API service in `frontend/src/services/customFields.ts`
- **驗證**: 可在專案設定中管理自定義欄位
### 7. Dynamic field rendering in Task forms
- [x] Create `frontend/src/components/CustomFieldInput.tsx` - 動態欄位輸入
- [x] Integrate into TaskDetailModal.tsx
- [x] Integrate into task creation form
- [x] Handle different field types (text, number, dropdown, date, person)
- [x] Display formula fields as read-only
- **驗證**: 任務表單正確顯示和儲存自定義欄位
### 8. Display custom fields in task views
- [x] Add custom field columns to List view
- [x] Display custom field values in Kanban cards (optional, configurable)
- [x] 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