[CLAUDE] Docs: Session 17 wrap-up — PE Workflow V2 end-to-end consolidation

User chốt MD wrap-up Session 17 (13 commit từ c847dc0de0f38d) — PE
Workflow V2 schema + Service wire + UX iteration đầy đủ.

MD updates:
- STATUS.md — header counts (24 mig, 58 tables, 81 test, 43 gotcha) +
  Recently Done row consolidate Session 17 wrap-up (gộp 4 row iter cũ
  thành 1 row tổng, không cắt narrative quan trọng)
- HANDOFF.md — TL;DR Session 17 + Chunk E (Designer iter + State
  machine + Service wire + UX) + Pending Session 18+
- CLAUDE.md — count (22→24 mig, 77→81 test) + V2 schema overview
- changelog/migration-todos.md — section  Session 17 done với 7 task
  ticked + Defer Session 18+ explicit
- database/schema-diagram.md — §14 ApprovalWorkflow V2 schema (3 bảng
  + 2 column PE + state transitions + Service branch + Designer
  constraints + match approver V2 vs V1 table)
- gotchas.md — +#42 Dual schema branch + #43 Step.Order ≠ index 0-based
- skill contract-workflow — +section "Phase 9+ done Mig 22-24" với V2
  spec + Service branch + match logic table + Designer constraints +
  UX V2-aware + Defer Session 18+
- changelog/sessions/2026-05-08-1100-pe-workflow-v2-end-to-end.md (NEW)
  — full session log với 13 commit timeline + stats + gotchas + pending

Memory:
- project_solution_erp.md — entry Session 17 wrap-up đầy đủ (KHÔNG tạo
  file feedback mới — decisions specific cho project, không reusable
  cross-project per §9.5 anti-pattern)

Verify:
- 81 test pass (58 Domain + 23 Infra) — không thay đổi sau wrap-up
- 0 BE error
- 2 FE builds OK (đã verify ở các commit trước)
- Quy tắc consolidate §6.5: KHÔNG cắt narrative, chỉ phân tầng + remove
  duplicate. Session 17 row dài cố ý — cover full 13 commit context cho
  Session 18+ đọc lại.
This commit is contained in:
pqhuy1987
2026-05-08 16:40:49 +07:00
parent de0f38dd25
commit 8680f4c849
8 changed files with 411 additions and 19 deletions

View File

@ -50,7 +50,7 @@ Kiến trúc: **.NET 10 Clean Architecture + 2 React FE (admin + user) + SQL Ser
- Audit fields: `CreatedAt`, `UpdatedAt`, `CreatedBy`, `UpdatedBy` (`BaseEntity`)
- Soft delete: `IsDeleted`, `DeletedAt`, `DeletedBy` (`AuditableEntity`)
- Migrations: `dotnet ef migrations add <Name> --project src/Backend/SolutionErp.Infrastructure --startup-project src/Backend/SolutionErp.Api`
- **Hiện có 22 migration → 58 bảng** (Phase 9+ — Mig 22 `AddApprovalWorkflowsV2` Session 17 schema mới UAT trước khi drop legacy: Quy trình > Bước (Phòng) > Cấp (NV cụ thể qua ApproverUserId — KHÔNG OR-of-many). Schema riêng `ApprovalWorkflows` + `ApprovalWorkflowSteps` + `ApprovalWorkflowLevels`. PE/Contract Service CHƯA wire — vẫn pin Mig 21 legacy. Mig 21 `RefactorWorkflowToFlatModel` DRASTIC REFACTOR Session 16. Phase enum simplify ChoDuyet=10 đơn nhất + CurrentWorkflowStepIndex tracking. Workflow flat list (Phòng × Cấp × Approvers). PE 3-button Duyệt/Trả lại/Từ chối)
- **Hiện có 24 migration → 58 bảng** (Phase 9+ Session 17 wrap-up — Mig 22-24 V2 schema PE end-to-end: Quy trình > Bước (Phòng) > Cấp (N NV cụ thể qua ApproverUserId, OR-of-N cùng cấp). 3 bảng mới `ApprovalWorkflows` + Steps + Levels. Mig 23 pin `PE.ApprovalWorkflowId`. Mig 24 `PE.CurrentApprovalLevelOrder` track Cấp đang chờ. State machine 5 trạng thái: Nháp / Đã gửi duyệt / Trả lại (Phase riêng TraLai=98) / Từ chối / Đã duyệt. PE Service V2 wire: iterate Steps/Levels match `actor.Id == ApproverUserId`. Contract V2 chưa wire (defer session sau). 81 test pass. Mig 21 V1 flat workflow Mig 21 vẫn live cho phiếu cũ.)
### Modules
@ -63,7 +63,7 @@ Kiến trúc: **.NET 10 Clean Architecture + 2 React FE (admin + user) + SQL Ser
| Identity (User/Role/Permission/MenuItem) | `Domain/Identity/` | 1, 3, 11 | Feature-complete (30 demo user — 16 sample + 14 Solutions thật) |
| Forms (Template + Clause) | `Domain/Forms/` | 4 | Feature-complete |
| Notifications | `Domain/Notifications/` | 6 | In-app + SignalR OK, email SMTP TODO |
| **Tests** | `tests/SolutionErp.{Domain,Infrastructure}.Tests/` | — | **83 test pass** (54 Domain + 29 Infra: 17 codegen + 6 PE WF + 6 PE 2-stage approval) — CI gate + path filter docs-only skip |
| **Tests** | `tests/SolutionErp.{Domain,Infrastructure}.Tests/` | — | **81 test pass** (58 Domain + 23 Infra: 17 codegen + 6 PE WF) — CI gate + path filter docs-only skip |
### Commit convention
@ -84,7 +84,7 @@ tests/
└── Application/ (6 test - PeWorkflowDefinition versioning)
```
**77 unit test pass** / ~3s (54 Domain + 23 Infra: 17 codegen + 6 PE WF versioning). Mig 21 drop 19 legacy N-stage/2-stage tests. CI gate + path filter live.
**81 unit test pass** / ~3s (58 Domain + 23 Infra: 17 codegen + 6 PE WF versioning). +4 TraLai entry-point tests Session 17 (Standard_TraLai_To_DangGopY + BothPolicies_TraLai_To_ChoPurchasing + NextPhasesFrom_TraLai). Mig 21 drop 19 legacy N-stage/2-stage tests. CI gate + path filter live.
```bash
dotnet test SolutionErp.slnx # chạy cả 2 test project