690404:1139 Modify ADR
This commit is contained in:
@@ -10,6 +10,20 @@
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Gap Analysis & Purpose
|
||||
|
||||
### ปิด Gap จากเอกสาร:
|
||||
- **Unified Workflow Requirements** - Section 2.1: "LCBP3-DMS ต้องรองรับเอกสารหลายประเภทพร้อม Workflow ที่แตกต่างกัน"
|
||||
- เหตุผล: ระบบเดิมไม่มีกลไกส่วนกลางสำหรับจัดการ Workflow ทำให้เกิด Code Duplication
|
||||
- **Software Architecture** - Section 3.2: "ระบบต้องมีความยืดหยุ่นในการเพิ่ม Document Type ใหม่"
|
||||
- เหตุผล: การ Hard-code Workflow ทำให้การเพิ่มประเภทเอกสารใหม่ทำได้ยาก
|
||||
|
||||
### แก้ไขความขัดแย้ง:
|
||||
- **Correspondence Requirements** vs **RFA Requirements**: ทั้งสอง Module ต้องการ State Management แต่ใช้วิธีต่างกัน
|
||||
- การตัดสินใจนี้ช่วยแก้ไขโดย: สร้าง Unified Engine ที่รองรับทุก Document Type
|
||||
|
||||
---
|
||||
|
||||
## Context and Problem Statement
|
||||
|
||||
LCBP3-DMS ต้องจัดการเอกสารหลายประเภท (Correspondences, RFAs, Circulations) โดยแต่ละประเภทมี Workflow การเดินเอกสารที่แตกต่างกัน:
|
||||
@@ -113,6 +127,74 @@ LCBP3-DMS ต้องจัดการเอกสารหลายประ
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Impact Analysis
|
||||
|
||||
### Affected Components (ส่วนประกอบที่ได้รับผลกระทบ)
|
||||
|
||||
| Component | Level | Impact Description | Required Action |
|
||||
|-----------|-------|-------------------|-----------------|
|
||||
| **Backend** | 🔴 High | ต้องสร้าง Workflow Engine Module ใหม่ และ Refactor ทุก Document Service | Implement WorkflowEngineService |
|
||||
| **Database** | 🔴 High | เพิ่ม Tables: workflow_definitions, workflow_instances, workflow_histories | Create new schema |
|
||||
| **Frontend** | 🟡 Medium | ต้อง Update UI สำหรับ Workflow Status และ Actions | Update components |
|
||||
| **API** | 🔴 High | ต้องสร้าง Workflow API endpoints และ Update ทุก Document API | New endpoints + updates |
|
||||
| **Testing** | 🟡 Medium | ต้องเขียน Tests สำหรับ Workflow Engine และ Integration Tests | New test suites |
|
||||
|
||||
### Required Changes (การเปลี่ยนแปลงที่ต้องดำเนินการ)
|
||||
|
||||
#### 🔴 Critical Changes (ต้องทำทันที)
|
||||
- [ ] **Create Workflow Engine Module** - backend/src/modules/workflow-engine/: สร้าง Engine หลัก
|
||||
- [ ] **Implement Database Schema** - specs/03-Data-and-Storage/: เพิ่ม workflow tables
|
||||
- [ ] **Refactor Correspondence Service** - backend/src/modules/correspondence/: ใช้ Workflow Engine
|
||||
- [ ] **Refactor RFA Service** - backend/src/modules/rfa/: ใช้ Workflow Engine
|
||||
- [ ] **Refactor Circulation Service** - backend/src/modules/circulation/: ใช้ Workflow Engine
|
||||
|
||||
#### 🟡 Important Changes (ควรทำภายใน 2 สัปดาห์)
|
||||
- [ ] **Update Frontend Workflow Components** - frontend/components/workflow/: UI สำหรับ Workflow
|
||||
- [ ] **Create Workflow API Endpoints** - backend/src/modules/workflow-engine/controller.ts: REST API
|
||||
- [ ] **Add Workflow DSL Validation** - backend/src/modules/workflow-engine/dsl-validator.ts: JSON Schema validation
|
||||
- [ ] **Implement Workflow History Tracking** - backend/src/modules/workflow-engine/history.service.ts: Audit trail
|
||||
|
||||
#### 🟢 Nice-to-Have (ทำถ้ามีเวลา)
|
||||
- [ ] **Create Admin UI for Workflow Design** - frontend/app/(admin)/admin/workflow/: Visual workflow builder
|
||||
- [ ] **Add Workflow Performance Monitoring** - backend/src/modules/workflow-engine/monitoring.service.ts: Metrics
|
||||
|
||||
### Cross-Module Dependencies
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
ADR[ADR-001 Workflow Engine] --> Corr[Correspondence Service]
|
||||
ADR --> RFA[RFA Service]
|
||||
ADR --> Circ[Circulation Service]
|
||||
ADR --> DB[(Database Schema)]
|
||||
ADR --> API[Workflow API]
|
||||
|
||||
Corr --> ADR002[ADR-002 Document Numbering]
|
||||
RFA --> ADR002
|
||||
Circ --> ADR002
|
||||
|
||||
API --> ADR006[ADR-006 Redis Caching]
|
||||
DB --> ADR009[ADR-009 Migration Strategy]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Version Dependency Matrix
|
||||
|
||||
| ADR | Version | Dependency Type | Affected Version(s) | Implementation Status |
|
||||
|-----|---------|-----------------|---------------------|----------------------|
|
||||
| **ADR-001** | 1.0 | Core | v1.8.0+ | ✅ Implemented |
|
||||
| **ADR-002** | 1.0 | Required By | v1.8.0+ | ✅ Implemented |
|
||||
| **ADR-006** | 1.0 | Uses | v1.8.0+ | ✅ Implemented |
|
||||
| **ADR-009** | 1.0 | Database Changes | v1.8.0+ | ✅ Implemented |
|
||||
|
||||
### Version Compatibility Rules
|
||||
|
||||
- **Minimum Version:** v1.8.0 (ADR มีผลบังคับใช้)
|
||||
- **Breaking Changes:** ไม่มี (Backward compatible API)
|
||||
- **Deprecation Timeline:** ไม่มี (Core architecture)
|
||||
|
||||
---
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### Database Schema
|
||||
@@ -330,6 +412,26 @@ export class WorkflowEngineService {
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Review Cycle & Maintenance
|
||||
|
||||
### Review Schedule
|
||||
- **Next Review:** 2026-08-24 (6 months from last review)
|
||||
- **Review Type:** Scheduled (Core Principle Review)
|
||||
- **Reviewers:** System Architect, Development Team Lead, Product Owner
|
||||
|
||||
### Review Checklist
|
||||
- [ ] ยังคงเป็น Core Principle หรือไม่? (Workflow Engine เป็นหัวใจสำคัญของระบบ)
|
||||
- [ ] มีการเปลี่ยนแปลง Technology ที่กระทบหรือไม่? (New Workflow Engine alternatives)
|
||||
- [ ] มี Issue หรือ Bug ที่เกิดจาก ADR นี้หรือไม่? (Performance bottlenecks, State inconsistencies)
|
||||
- [ ] ต้องการ Update หรือ Deprecate หรือไม่? (DSL evolution, New document types)
|
||||
|
||||
### Version History
|
||||
| Version | Date | Changes | Status |
|
||||
|---------|------|---------|--------|
|
||||
| 1.0 | 2026-02-24 | Initial version - DSL-based Unified Workflow Engine | ✅ Active |
|
||||
|
||||
---
|
||||
|
||||
## Related ADRs
|
||||
|
||||
- [ADR-002: Document Numbering Strategy](./ADR-002-document-numbering-strategy.md) - ใช้ Workflow Engine trigger Document Number Generation
|
||||
|
||||
Reference in New Issue
Block a user