[CLAUDE] Docs: chốt session 2026-04-23 chiều — toolkit + 4-bảng + master + roles VN
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m47s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m47s
11 commit feature work (b75448e→ae59cfe) → docs sync. ## STATUS.md - Last updated 2026-04-23 16:00 - Phase header: Tier 3 + 4-bảng + master catalogs + roles VN - 7 Recently Done row mới (3-panel layout, 4-bảng overhaul, Thao tác 2-panel, Mã HĐ gen Create, master catalogs, roles VN demo users) - Cumulative table thêm cột "+Toolkit/Catalogs/Roles" (DB 36, endpoints ~80, migrations 11, commits ~47) - Session log link mới - Skill list count = 13 file ## HANDOFF.md - TL;DR cập nhật: 36 tables, 80 endpoints, 11 migrations - Phase table thêm 5 row Done (3-panel, 4-bảng, mã HĐ, master, roles) - Git state 18 commit gần nhất - Credentials block thêm 13 demo user (User@123456) — warn rotate trước UAT ## migration-todos.md Section "Session 2026-04-23 (chiều)" với 14 ticked checkbox + commit refs. ## schema-diagram.md - Header: 24 → 36 bảng - Migration table thêm row 9-11 (highlighted) - Section 8bis mới: chi tiết 7 Details + ContractChangelogs + 4 Catalogs + Role.ShortName + User.DepartmentId/Position ## Session log mới `docs/changelog/sessions/2026-04-23-1500-toolkit-data-roles.md` (~270 dòng) — outcome A→I, stats cumulative, 6 architectural decisions, next session priority. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# Schema Diagram — Luồng DB SOLUTION_ERP
|
||||
|
||||
> ERD đầy đủ + mối quan hệ **24 table** sau Tier 3 (Notifications + Versioned workflows). Mermaid render ở VS Code / GitHub / Gitea.
|
||||
> ERD đầy đủ + mối quan hệ **36 table** sau Migration 11 (Tier 3 + 4-bảng overhaul + 4 master catalogs + Role/User VN). Mermaid render ở VS Code / GitHub / Gitea.
|
||||
|
||||
## 1. Full ERD
|
||||
|
||||
@ -477,8 +477,67 @@ COMMIT;
|
||||
| 6 | `AddNotifications` | Notifications |
|
||||
| 7 | `AddWorkflowTypeAssignments` | WorkflowTypeAssignments (admin override legacy) |
|
||||
| 8 | `AddVersionedWorkflows` | WorkflowDefinitions, WorkflowSteps, WorkflowStepApprovers + Contracts.WorkflowDefinitionId FK |
|
||||
| **9** | **`AddContractDetailsAndChangelog`** | **7 ContractType-specific Details + ContractChangelogs (unified audit log)** |
|
||||
| **10** | **`AddMasterCatalogs`** | **UnitsOfMeasure, MaterialItems, ServiceItems, WorkItems** |
|
||||
| **11** | **`AddRoleShortNameAndUserDepartment`** | **+Role.ShortName + User.DepartmentId/Position (cột thêm, không bảng mới)** |
|
||||
|
||||
Tổng: **24 bảng** (+ `__EFMigrationsHistory` hệ thống).
|
||||
Tổng: **36 bảng** (+ `__EFMigrationsHistory` hệ thống).
|
||||
|
||||
## 8bis. Bảng mới sau Migration 9-11
|
||||
|
||||
### Per-type Details (7 bảng — Migration 9)
|
||||
|
||||
Mỗi loại HĐ có bảng riêng. Common base: `Id`, `ContractId` FK Cascade,
|
||||
`Order` int, `ThanhTien` decimal(18,2), `GhiChu` nvarchar(1000) +
|
||||
`AuditableEntity` (CreatedAt/By/UpdatedAt/By).
|
||||
|
||||
| Bảng | Loại HĐ (Type) | Field đặc trưng |
|
||||
|---|---|---|
|
||||
| `ThauPhuDetails` | 1 | HangMuc, DonViTinh, KhoiLuong, DonGia, ThoiGianHoanThanh |
|
||||
| `GiaoKhoanDetails` | 2 | MaCongViec, TenCongViec, KhoiLuong, DonGia, YeuCauKyThuat |
|
||||
| `NhaCungCapDetails` | 3 | MaSP, TenSP, ThongSoKyThuat, SoLuong, DonGia, ThoiGianGiao, XuatXu |
|
||||
| `DichVuDetails` | 4 | MaDichVu, TenDichVu, ThoiGian, DonGia, TuNgay/DenNgay |
|
||||
| `MuaBanDetails` | 5 | MaSP, TenSP, SoLuong, DonGia, **ThueVAT** decimal(5,2), XuatXu |
|
||||
| `NguyenTacNccDetails` | 6 | NhomSP, TenSP, **DonGiaToiThieu/ToiDa** (range), DieuKien |
|
||||
| `NguyenTacDvDetails` | 7 | LoaiDichVu, TenDichVu, DonGiaToiThieu/ToiDa, PhamViDichVu, SLA |
|
||||
|
||||
### ContractChangelogs (Migration 9)
|
||||
|
||||
Unified audit log cho mọi entity HĐ:
|
||||
- `Id`, `ContractId` FK Cascade
|
||||
- `EntityType` int enum: 1=Contract, 2=Detail, 3=Workflow, 4=Comment, 5=Attachment
|
||||
- `EntityId` Guid? (PK của child entity, null nếu là Header)
|
||||
- `Action` int enum: 1=Insert, 2=Update, 3=Delete, 4=Transition
|
||||
- `PhaseAtChange` int? (snapshot Phase tại thời điểm change)
|
||||
- `UserId` Guid? + `UserName` nvarchar(200) (denormalize cho readable)
|
||||
- `Summary` nvarchar(500), `FieldChangesJson` nvarchar(max), `ContextNote` nvarchar(2000)
|
||||
- Indexes: (ContractId, CreatedAt), (ContractId, EntityType)
|
||||
|
||||
### 4 Master Catalogs (Migration 10)
|
||||
|
||||
Phục vụ autocomplete trong Details add form (FE HTML5 datalist).
|
||||
|
||||
| Bảng | Field | Dùng cho HĐ Detail |
|
||||
|---|---|---|
|
||||
| `UnitsOfMeasure` | Code, Name, Description | Tất cả 7 type (donViTinh) |
|
||||
| `MaterialItems` | Code, Name, Category, DefaultUnit, Specification, OriginCountry, IsActive | NCC + Mua bán + Nguyên tắc NCC |
|
||||
| `ServiceItems` | Code, Name, Category, DefaultUnit, Description, IsActive | Dịch vụ + Nguyên tắc DV |
|
||||
| `WorkItems` | Code, Name, Category, DefaultUnit, Description, IsActive | Thầu phụ + Giao khoán |
|
||||
|
||||
Common: `AuditableEntity`, `IX_<Table>_Code` UNIQUE filtered `IsDeleted=0`,
|
||||
`IX_<Table>_Category`, `HasQueryFilter !IsDeleted`.
|
||||
|
||||
### Identity columns thêm (Migration 11)
|
||||
|
||||
**Role:**
|
||||
- `ShortName` nvarchar(50) — Mã viết tắt VN (QTV/BOD/CCM/PRO/FIN/...)
|
||||
- `Description` đã có — full Vietnamese label
|
||||
|
||||
**User:**
|
||||
- `DepartmentId` Guid? FK Departments **OnDelete Restrict** (không xóa
|
||||
dept nếu còn user reference)
|
||||
- `Position` nvarchar(200) — chức vụ free text
|
||||
- `IX_Users_DepartmentId`
|
||||
|
||||
## 9. Versioned workflow invariants
|
||||
|
||||
|
||||
Reference in New Issue
Block a user