Backend (FastAPI): - Database migration for spaces, projects, task_statuses, tasks tables - SQLAlchemy models with relationships - Pydantic schemas for CRUD operations - Spaces API: CRUD with soft delete - Projects API: CRUD with auto-created default statuses - Tasks API: CRUD, status change, assign, subtask support - Permission middleware with Security Level filtering - Subtask depth limit (max 2 levels) Frontend (React + Vite): - Layout component with navigation - Spaces list page - Projects list page - Tasks list page with status management Fixes: - auth_client.py: use 'username' field for external API - config.py: extend JWT expiry to 7 days - auth/router.py: sync Redis session with JWT expiry Tests: 36 passed (unit + integration) E2E: All APIs verified with real authentication OpenSpec: add-task-management archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.8 KiB
1.8 KiB
Proposal: add-task-management
Summary
實作任務管理核心系統,包含 Space > Project > Task > Sub-task 多層級架構、基本 CRUD 操作、狀態管理與任務指派功能。
Motivation
任務管理是專案控制系統的核心功能,其他模組(資源管理、協作、自動化)都依賴於任務資料。需優先建立穩固的任務管理基礎。
Scope
包含 (In Scope)
-
資料模型
- pjctrl_spaces: 空間管理
- pjctrl_projects: 專案管理
- pjctrl_tasks: 任務與子任務管理
- pjctrl_task_statuses: 任務狀態定義
-
API 端點
- Spaces CRUD: GET/POST/PATCH/DELETE /api/spaces
- Projects CRUD: GET/POST/PATCH/DELETE /api/projects
- Tasks CRUD: GET/POST/PATCH/DELETE /api/tasks
- Task 狀態管理與指派
-
權限控制
- Space/Project 層級的存取權限
- Security Level 隔離 (public, department, confidential)
- 任務指派權限驗證
-
前端基礎
- Space/Project 列表與詳情頁
- Task 列表視角 (List View)
- 任務建立/編輯表單
不包含 (Out of Scope)
- 自定義欄位 (Custom Fields) - 下一階段
- 看板視角 (Kanban View) - 下一階段
- 甘特圖視角 (Gantt View) - 下一階段
- 行事曆視角 (Calendar View) - 下一階段
- WebSocket 即時同步 - 下一階段
- 公式欄位計算 - 下一階段
Affected Specs
task-management: 新增 Purpose 區塊,補充 ADDED Requirements
Dependencies
user-auth: 需使用認證中間件與使用者資料
Risks
-
資料模型複雜度: 多層級結構可能導致查詢效能問題
- 緩解: 適當建立索引,限制子任務深度
-
權限檢查效能: 每次 API 請求都需驗證權限
- 緩解: Redis 快取使用者權限資料