Files
solution-erp/docs/changelog/sessions/2026-04-21-1045-phase0-scaffold.md
pqhuy1987 702411fcc8 [CLAUDE] Phase1: foundation - BE Clean Arch + Identity + JWT + 2 FE React + login E2E
Backend (.NET 10):
- Domain: BaseEntity/AuditableEntity, ContractType/Phase/ApprovalDecision enums, User/Role (Identity<Guid>), AppRoles (12 const)
- Application: IApplicationDbContext/ICurrentUser/IDateTime/IJwtTokenService, custom exceptions, ValidationBehavior (MediatR pipeline), Auth CQRS (Login/Refresh/Me), DependencyInjection
- Infrastructure: ApplicationDbContext (IdentityDbContext), AuditingInterceptor (auto audit + soft delete), DbInitializer (seed 12 role + admin), DesignTimeDbContextFactory, JwtTokenService, DateTimeService, DI
- Api: CurrentUserService, GlobalExceptionMiddleware (ProblemDetails), AuthController, Program.cs rewrite (Serilog + JWT + CORS + Swagger), appsettings + launchSettings (port 5443)
- Migration Init applied to SolutionErp_Dev LocalDB

Frontend (React 19 + Vite 8 + Tailwind 4):
- fe-admin (:8082 blue) + fe-user (:8080 emerald) - shared structure, khac menu + brand color
- Tailwind 4 via @tailwindcss/vite plugin, theme brand colors
- AuthContext (localStorage token), ProtectedRoute, Layout (sidebar + header)
- UI kit: Button/Input/Label (CVA + Tailwind)
- LoginPage voi toast error, DashboardPage/InboxPage placeholder
- Axios interceptor: auto Bearer + 401 redirect
- TanStack Query client, React Router 7, Sonner toast

Package downgrades (do .NET 10 / TS 6 compat):
- MediatR 14 -> 12.4.1 (v14 breaking changes)
- Swashbuckle 10 -> 6.9.0 (v10 khong tuong thich OpenApi 2)
- Removed Microsoft.AspNetCore.OpenApi (conflict voi Swashbuckle)

E2E verified: POST /api/auth/login qua Vite proxy ca 2 FE -> JWT + user info

Credentials seed: admin@solutionerp.local / Admin@123456

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 10:59:44 +07:00

69 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Session 2026-04-21 10:45 — Phase 0 Scaffold complete
**Dev:** Claude (Opus 4.7)
**Duration:** ~45 phút
**Commit:** `25dad7f`
## Làm được
### Scaffold
- Root `SOLUTION_ERP/` + toàn bộ cấu trúc thư mục
- `.NET 10` solution + 4 project Clean Arch (Domain / Application / Infrastructure / Api)
- NuGet packages: MediatR, FluentValidation, AutoMapper, EF Core SqlServer, Identity, JWT Bearer, Swashbuckle, Serilog
- 2 React + Vite + TS apps: `fe-admin` (8082), `fe-user` (8080), proxy `/api → :5443`, Node `>=20`, `.nvmrc=20`
- Root config: `.gitignore`, `global.json` (SDK 10.0.104), `docker-compose.yml` (SQL Server 2022), `README.md`
### Domain analysis
- Parse 8 form HĐ → `docs/forms-spec.md`:
- 5 form parsed OK (FO-002.01, .04, .05, .07, RG-001)
- 3 file `.doc` (FO-002.02, .03, .06) không unzip được → TODO Phase 2 convert qua Word COM / LibreOffice
- Extract **regex mã HĐ** từ RG-001: `{Project}/{Type}/SOL&{Partner}/{Seq}` + 5 biến thể cho PO/framework
- Parse QUY_TRINH → `docs/workflow-contract.md`:
- **9 phase state machine** (DangChon → DangSoanThao → DangGopY → DangDamPhan → DangInKy → DangKiemTraCCM → DangTrinhKy → DangDongDau → DaPhatHanh + TuChoi)
- **Role × Phase matrix** 9 role × 9 phase
- SLA mỗi phase (tổng ~19 ngày)
- Mermaid state diagram + notification triggers + data model implication
### Docs
- `CLAUDE.md` (root pointer)
- `docs/CLAUDE.md` (full context: tech stack + project layout + conventions)
- `docs/STATUS.md` (snapshot)
- `docs/PROJECT-MAP.md` (module map + API namespace + FE screens + flow chính)
- `docs/changelog/migration-todos.md` (roadmap 5 phase, ~100 atomic task)
### Skills (3 placeholder)
- `contract-workflow` (sẽ expand Phase 3)
- `form-engine` (sẽ expand Phase 2)
- `permission-matrix` (sẽ expand Phase 1)
## Quyết định kiến trúc đã chốt
| # | Item | Chốt | Lý do |
|---|---|---|---|
| 1 | Backend | Clean Architecture + CQRS + MediatR + EF migrations | Theo DH_Y_DUOC — dự án mới nên làm đúng bài |
| 2 | DB | SQL Server 2022 | Consistent với NamGroup + DHYD, user chốt |
| 3 | FE | 2 app React 19 + Vite 8 + TS (auto-scaffold) | Vite latest; nếu cần downgrade về React 18 thì làm Phase 1 đầu |
| 4 | Deploy | Windows Server + IIS | User chốt, không Docker |
| 5 | Lang UI | 100% tiếng Việt (code + table name = English) | User chốt |
| 6 | AI service | BỎ luôn | User chốt, không Python |
| 7 | Team | Solo (user + Claude) | Không skill Copilot collaboration |
| 8 | Node | local `>=20`, CI pin `20.x` | Bài học NamGroup (CI fail với Node mới) |
## Handoff cho session tiếp theo
**Phase 1 start:** backend foundation + auth + permission + CRUD master + FE layout + login page.
**Đọc trước khi code:**
1. [docs/STATUS.md](../../STATUS.md) — snapshot
2. [docs/workflow-contract.md](../../workflow-contract.md) — 9 phase (ảnh hưởng Domain model)
3. [docs/forms-spec.md](../../forms-spec.md) — RG-001 code format
4. [docs/changelog/migration-todos.md](../migration-todos.md) section **Phase 1**
**Blocker:**
- ⏳ Chờ user cấp URL Gitea → push remote
**Không ngầm giả định:**
- React 19 vs 18: scaffold ra 19, nếu muốn 18 thì phải downgrade sớm
- Aspose.Words (phí) vs OpenXml (free) cho Phase 2 — chưa quyết
- SignalR cho real-time notification Phase 3 — optional, chưa quyết