Include supplementary documentation, research notes on Lexical/UX, and setup guides.
9.4 KiB
規劃更新摘要 - Story 1.2 Payload CMS Collections
更新日期: 2025-01-30 更新類型: 詳細規劃調整 影響範圍: Story 1.2, 1.9, 1.10, 1.12
📊 執行摘要
根據用戶要求「調整規劃,更新相關的 stories」,我已完成:
- ✅ 創建詳細的 Payload CMS 修改計劃
- ✅ 更新 Story 1.2 執行計劃
- ✅ 重新估算時間(減少 50%)
- ✅ 定義相關 Stories 依賴關係
📁 新增/更新的文檔
1. 新增文檔
📄 docs/prd/payload-cms-modification-plan.md
- 用途: Story 1.2 的詳細實作指南
- 內容:
- 7 個詳細任務定義(Task 1.2.1 - 1.2.7)
- 每個任務的完整代碼範例
- Webflow → Payload 欄位對應表
- 驗收標準和測試計劃
- 相關 Stories 依賴更新
2. 更新文檔
📄 docs/prd/epic-1-execution-plan.md
- 更新部分: Story 1.2 詳細執行計劃
- 主要變更:
- 重寫 Story 1.2 章節(原 74-280 行)
- 階段化實作計劃(Phase 1-3)
- Webflow 欄位對應表
- 角色權限矩陣
- 更新 Sprint 0 和 Sprint 1 時間估算
🎯 關鍵決策更新
Story 1.2 時間估算
| 項目 | 原估計 | 更新後 | 變化 |
|---|---|---|---|
| Story 1.2 | 8-12 小時 | 4 小時 | -50% ~ -66% |
| Sprint 0 | 8-12 小時 | 2.5 小時 | -75% |
| Sprint 1 | 24-30 小時 | 3 小時 | -90% |
理由:
- Payload CMS 架構清晰,修改簡單直接
- Access control 模式一致,易於批量應用
- 詳細計劃減少了不確定性和反覆修改
- 大部分欄位是標準類型(text/select/upload)
Story 1.2 任務結構
原計劃: 5 個 tasks(定義模糊) 更新後: 7 個 tasks(詳細定義)
| Phase | Task | 內容 | 時間 |
|---|---|---|---|
| Phase 1 | 1.2.1 | 創建 Portfolio Collection | 1 小時 |
| (Critical) | 1.2.2 | 完善 Categories Collection | 30 分鐘 |
| Phase 2 | 1.2.3 | 完善 Posts Collection | 30 分鐘 |
| (Enhancement) | 1.2.4 | 完善 Users Collection | 30 分鐘 |
| Phase 3 | 1.2.5 | 創建 Access Control 函數 | 30 分鐘 |
| (Security) | 1.2.6 | 應用 Access Control | 30 分鐘 |
| 1.2.7 | 驗證和測試 | 1 小時 | |
| 總計 | 4 小時 |
🔗 相關 Stories 依賴更新
Story 1.9: Blog System(更新)
新增依賴項:
Story 1.9 依賴 Story 1.2 完成:
+ Categories.textColor/backgroundColor → category badge theming
+ Posts.excerpt → article list display(150-200 字)
+ Posts.status → filter published posts(draft/review/published)
Task 1.9.2(Blog Listing Page)更新:
+ 從 Payload API 載入已發布文章(where: { status: 'published' })
+ 顯示 category badge(使用動態顏色 category.textColor/backgroundColor)
+ 顯示文章摘要(使用 post.excerpt,最多 200 字)
Task 1.9.4(Category Page)更新:
+ 分類顏色主題(使用 category.textColor/backgroundColor)
+ Badge 使用動態顏色而非固定顏色
+ 分類名稱顯示 category.nameEn(如果存在)
Story 1.10: Portfolio(更新)
新增依賴項:
Story 1.10 依賴 Story 1.2 完成:
+ Portfolio collection 必須存在(7 個欄位)
+ 所有欄位必須定義才能實作前端頁面
Task 1.10.1(Design Portfolio Architecture)簡化:
- 決定是否使用 Payload CMS collection
+ Portfolio collection 已在 Story 1.2 創建(Task 1.2.1)
- 欄位規劃
+ 欄位已在 Story 1.2 定義:
+ title, slug, url, image, description, websiteType, tags
+ 此 Task 改為專注於前端路由和組件架構設計
Task 1.10.2(Implement Portfolio Listing Page)更新:
+ Portfolio card 顯示:
+ - Project image (image 欄位)
+ - Project title (title 欄位)
+ - Description (description 欄位)
+ - Tags (tags array)
+ - Website type badge (websiteType 欄位)
Story 1.12: Authentication(更新)
新增依賴項:
Story 1.12 依賴 Story 1.2 Phase 3 完成:
+ Users.role 欄位必須存在(admin/editor)
+ adminOnly/adminOrEditor 函數必須創建
+ 所有 Collections 必須應用 access control
Task 1.12.5(Implement Role-Based Access Control)簡化:
- Users collection 添加 role 欄位
+ Users collection 已在 Story 1.2 Task 1.2.4 添加 role 欄位
- 建立 access/adminOnly.ts
+ access/adminOnly.ts 已在 Story 1.2 Task 1.2.5 創建
- 建立 access/adminOrEditor.ts
+ access/adminOrEditor.ts 已在 Story 1.2 Task 1.2.5 創建
- 更新 Collections 的 access rules
+ Collections 已在 Story 1.2 Task 1.2.6 應用 access rules
+ 此 Task 改為專注於測試驗證角色權限
📋 Collection 完成度總覽
Story 1.2 完成後狀態
| Collection | 當前 | Story 1.2 後 | 新增欄位 |
|---|---|---|---|
| Portfolio | 0% | 100% ✅ | 7 個欄位 |
| Categories | 40% (2/6) | 100% ✅ | +4 欄位 |
| Posts | 60% (9/13) | 100% ✅ | +4 欄位 |
| Users | 70% (3/4) | 100% ✅ | +1 欄位 |
| Media | 90% | 100% ✅ | - |
| Pages | 100% | 100% ✅ | - |
Access Control 完成度
| 組件 | 當前 | Story 1.2 後 |
|---|---|---|
| Access 函數 | 3 個 | 5 個 ✅ |
| Collections 應用 | 部分 | 全部 ✅ |
| Globals 應用 | 無 | 完整 ✅ |
| 角色權限測試 | 無 | 完成 ✅ |
🔄 Sprint 調整影響
Sprint 0: Infrastructure Completion
調整前:
- Story 1.1: 40 分鐘
- Story 1.2: 不明確
- 總計:8-12 小時
調整後:
- Story 1.1: 40 分鐘
- Story 1.2 Phase 1: 1.5 小時
- 總計:2.5 小時(-75%)
理由: 專注於 Critical Blockers(Portfolio + Categories),解除 Story 1.9 和 1.10 的阻礙
Sprint 1: Collections Completion
調整前:
- Story 1.2 完成: 不明確
- Story 1.3 遷移: 12-16 小時
- 總計:24-30 小時
調整後:
- Story 1.2 Phase 2-3: 3 小時
- Story 1.3 遷移: 延後到 Sprint 2
- 總計:3 小時(-90%)
理由: 將 Story 1.2 拆分到 Sprint 0 和 Sprint 1,先完善 Collections 再遷移內容
Sprint 2: Migration & Layout(新增建議)
建議內容:
- Story 1.3: Content Migration Script (12-16 小時)
- Story 1.4: Header/Footer Components (8-10 小時)
- 總計:20-26 小時
理由: Collections 完成後,開始內容遷移和全局組件開發
📊 時間線總結
Epic 1 整體時間估算
| 階段 | 原估計 | 更新後 | 變化 |
|---|---|---|---|
| Sprint 0 (Infra) | 8-12 hr | 2.5 hr | -75% |
| Sprint 1 (Collections) | 24-30 hr | 3 hr | -90% |
| Sprint 2 (Migration) | - | 20-26 hr | 新增 |
| Sprint 3-5 (Pages/Apps) | 90-120 hr | 90-120 hr | 無變化 |
| Sprint 6 (Production) | 40-50 hr | 40-50 hr | 無變化 |
| 總計 | 162-212 hr | 155.5-201.5 hr | -4% |
關鍵變化:
- Sprint 0 和 Sprint 1 時間大幅減少(詳細規劃的效果)
- 新增 Sprint 2 專注於內容遷移和全局組件
- 整體時間線略微縮短,但更有組織性
✅ 驗收清單
Story 1.2 完成標準
Collection 完整性
- Portfolio: 7/7 欄位(title, slug, url, image, description, websiteType, tags)
- Categories: 6/6 欄位(title, nameEn, order, textColor, backgroundColor, slug)
- Posts: 13/13 欄位(含新增的 excerpt, ogImage, showInFooter, status)
- Users: 4/4 欄位(email, name, role, password)
- Media: 100%
- Pages: 100%
Access Control 完整性
- 5 個 access 函數完整
- 7 個 collections/globals 應用 access rules
- 角色權限矩陣測試通過
- Admin 可完整權限,Editor 僅內容管理
功能驗收
- 所有 collections 在 admin panel 可見
- 所有欄位可編輯
- 型別生成成功(
pnpm generate:types) - 開發環境正常運行
- R2 上傳測試通過
📝 後續行動建議
選項 A:開始執行 Story 1.2(推薦)
Phase 1 - Critical Blockers(今天):
- Task 1.2.1: 創建 Portfolio Collection (1 小時)
- Task 1.2.2: 完善 Categories Collection (30 分鐘)
預期成果:
- Story 1.9 和 1.10 的阻礙解除
- Portfolio 和 Categories 可用於前端開發
選項 B:繼續規劃其他 Stories
可以並行規劃:
- Story 1.3: Content Migration Script
- Story 1.4: Header/Footer Components
- Story 1.5-1.8: 頁面實作細節
選項 C:調整整體計劃
可能的調整:
- 重新評估 Story 1.3 的優先級(是否先遷移還是先實作頁面)
- 調整 Sprint 結構
- 修改時間線
📚 參考文檔
主要文檔:
docs/prd/payload-cms-modification-plan.md- Story 1.2 詳細實作指南docs/prd/epic-1-execution-plan.md- Epic 1 執行計劃(已更新)docs/prd/epic-1-stories-1.3-1.17-tasks.md- Stories 1.3-1.17 任務定義
相關文檔:
4. docs/prd/01-project-analysis.md - 項目分析
5. docs/prd/payload-cms-slimming-report.md - Payload CMS 瘩身報告
Payload CMS 官方文檔:
文檔版本: v1.0 最後更新: 2025-01-30 適用於: Payload CMS 3.59.1 狀態: ✅ 規劃完成,等待執行確認