[CLAUDE] Docs: S21 t5 Chunk D — chốt refactor Allow* per-NV (Mig 29)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m18s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m18s
Update docs theo rule §6.5 KEEP narrative:
- `docs/database/schema-diagram.md §14` title "Mig 22-29, S17-21":
- Update ApprovalWorkflows block: note Mig 28 cũ 6 column DROP, refactor per-NV
- Add 5 column Allow* trong ApprovalWorkflowLevels block (inline comment F1+F3)
- Add Users block với F2 AllowDrafterSkipToFinal Mig 29
- `docs/STATUS.md` Last updated S21 t5 + count 28→29 mig. UAT defer test count
unchanged 84.
- `docs/HANDOFF.md` Insert TL;DR S21 t5 đầy đủ (trước S21 t4):
- Trigger UAT feedback "cấu hình cho từng người"
- Q&A 2 lượt chốt scope
- 4 chunk narrative: A BE+Mig 29 + Service refactor → B FE Admin Designer
per-Level → C FE eOffice rename → D Docs
- Pattern reusable: EF migration reorder cho BACKFILL preserve data,
per-NV scope split theo role (Approver Level vs Drafter User)
- State table + Pending User Mgmt F2 UI defer
- NEW session log `docs/changelog/sessions/2026-05-13-1400-s21-turn5-refactor-allow-to-per-nv.md`:
- Code snippets BE/FE refactor
- 5 lessons learned (incl EF reorder pattern + backward compat backfill discipline)
- References file paths
Stats cumulative S21 t5:
- 29 mig (+1 Mig 29 refactor) · 59 tables · ~143 endpoints · 34 FE pages
- 84 test pass (UAT defer test-after §7) · 45 gotcha · 17 memory · 6 skills
- 4 commits S21 t5 cumulative ready push remote
Pending: bro confirm push `eea86fd..HEAD` 4 commits ahead.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -715,11 +715,15 @@ CREATE TABLE PurchaseEvaluationDepartmentOpinions (
|
||||
CREATE UNIQUE INDEX IX_PEDeptOpinions_PEId_Kind ON PurchaseEvaluationDepartmentOpinions (PurchaseEvaluationId, Kind);
|
||||
```
|
||||
|
||||
## 14. ApprovalWorkflow V2 schema (Migration 22-28, Session 17-21 — 3 bảng mới + 9 column)
|
||||
## 14. ApprovalWorkflow V2 schema (Migration 22-29, Session 17-21 — 3 bảng mới + 5 column Level + 1 column User)
|
||||
|
||||
Schema riêng song song WorkflowDefinition V1 (Mig 21) — pin per phiếu PE.
|
||||
V1 vẫn giữ cho phiếu cũ; V2 mới là active cho phiếu tạo từ Session 17 trở đi.
|
||||
|
||||
Mig 29 (S21 t5) — Refactor 6 Allow* options từ workflow-level (Mig 28 S21 t4)
|
||||
sang PER-NV: 5 flag F1+F3 xuống Level slot (Approver), 1 flag F2 xuống User
|
||||
(per-Drafter). Backfill bulk SQL preserve admin config S21 t4.
|
||||
|
||||
### Core (3 bảng):
|
||||
|
||||
```
|
||||
@ -728,15 +732,7 @@ ApprovalWorkflows
|
||||
├── ApplicableType (1=DuyetNcc, 2=DuyetNccPhuongAn, 3=Contract)
|
||||
├── Name, Description, IsActive, ActivatedAt
|
||||
├── IsUserSelectable (Mig 25, S18) — admin pin/unpin cho user pick lúc create phiếu
|
||||
│
|
||||
├── Mig 28 (S21 t4) — 6 advanced options "Cấu hình nâng cao" per workflow:
|
||||
├── AllowReturnOneLevel bit DEFAULT 0 — F1 mode: Trả về 1 Cấp trước (peer review)
|
||||
├── AllowReturnOneStep bit DEFAULT 0 — F1 mode: Trả về 1 Bước trước
|
||||
├── AllowReturnToAssignee bit DEFAULT 0 — F1 mode: Trả về Người chỉ định (pick runtime)
|
||||
├── AllowReturnToDrafter bit DEFAULT 1 — F1 mode: Trả về Drafter (S17 backward compat)
|
||||
├── AllowDrafterSkipToFinal bit DEFAULT 0 — F2: Drafter trình thẳng Cấp cuối, skip trung gian
|
||||
├── AllowApproverEditDetails bit DEFAULT 0 — F3: Approver chỉnh Section 2 lúc đang duyệt
|
||||
│
|
||||
│ (Mig 28 cũ 6 column Allow* đã DROP trong Mig 29 — refactor sang per-NV)
|
||||
└── (audit) CreatedAt, UpdatedAt, CreatedBy, UpdatedBy
|
||||
|
||||
ApprovalWorkflowSteps (FK Cascade ApprovalWorkflowId, FK Restrict DepartmentId)
|
||||
@ -747,7 +743,20 @@ ApprovalWorkflowSteps (FK Cascade ApprovalWorkflowId, FK Restrict DepartmentId)
|
||||
ApprovalWorkflowLevels (FK Cascade ApprovalWorkflowStepId, FK Restrict ApproverUserId)
|
||||
├── Id (PK), ApprovalWorkflowStepId, Order (1/2/3 trong Step)
|
||||
├── Name? (vd "Cấp 1"), ApproverUserId (1 NV cụ thể)
|
||||
│
|
||||
├── Mig 29 (S21 t5) — 5 advanced options per slot Approver (F1+F3):
|
||||
├── AllowReturnOneLevel bit DEFAULT 0 — F1 mode: Trả về 1 Cấp trước (peer review)
|
||||
├── AllowReturnOneStep bit DEFAULT 0 — F1 mode: Trả về 1 Bước trước
|
||||
├── AllowReturnToAssignee bit DEFAULT 0 — F1 mode: Trả về Người chỉ định
|
||||
├── AllowReturnToDrafter bit DEFAULT 1 — F1 mode: Trả về Drafter (S17 backward compat)
|
||||
├── AllowApproverEditDetails bit DEFAULT 0 — F3: NV này chỉnh Section 2 lúc đang duyệt
|
||||
│
|
||||
└── INDEX (ApprovalWorkflowStepId, Order) + INDEX ApproverUserId
|
||||
|
||||
Users (AspNetUsers extension)
|
||||
├── ... existing columns (FullName, DepartmentId, PositionLevel, CanBypassReview, etc)
|
||||
└── Mig 29 (S21 t5) — F2 per-Drafter:
|
||||
AllowDrafterSkipToFinal bit DEFAULT 0 — User được Drafter gửi PE thẳng Cấp cuối
|
||||
```
|
||||
|
||||
**Convention quan trọng:** nhiều `ApprovalWorkflowLevel` rows cùng `Order` trong cùng Step = **same Cấp với N approvers** (OR-of-N). Ví dụ Cấp 1 có 2 NV: 2 row Level cùng `Order=1` khác `ApproverUserId`.
|
||||
|
||||
Reference in New Issue
Block a user