251115:2300 update requirementd

This commit is contained in:
2025-11-17 23:43:11 +07:00
parent 94b63dc359
commit 693dd7f074
3 changed files with 823 additions and 10 deletions

View File

@@ -233,14 +233,14 @@ src/
### **Phase 0: Tasks** ### **Phase 0: Tasks**
- **[✅] T0.1 Setup QNAP Container Station** - **[✅] T0.1 Setup QNAP Container Station**
- สร้าง Docker Network: `lcbp3` - [✅]สร้าง Docker Network: `lcbp3`
- Setup docker-compose.yml สำหรับ: - [✅]Setup docker-compose.yml สำหรับ:
- MariaDB (db.np-dms.work) - [✅]MariaDB (db.np-dms.work)
- PHPMyAdmin (pma.np-dms.work) - [✅]PHPMyAdmin (pma.np-dms.work)
- Redis (cache.np-dms.work) - [ ]Redis (cache.np-dms.work)
- Elasticsearch (search.np-dms.work) - [ ]Elasticsearch (search.np-dms.work)
- Backend (backend.np-dms.work) - [✅]Backend (backend.np-dms.work)
- Nginx Proxy Manager (npm.np-dms.work) - [✅]Nginx Proxy Manager (npm.np-dms.work)
- กำหนด Environment Variables ใน docker-compose.yml (ไม่ใช้ .env) - กำหนด Environment Variables ใน docker-compose.yml (ไม่ใช้ .env)
- **Security:** Setup network segmentation และ firewall rules - **Security:** Setup network segmentation และ firewall rules
- [ ] **Deliverable:** Services ทั้งหมดรันได้และเชื่อมต่อกันผ่าน Network - [ ] **Deliverable:** Services ทั้งหมดรันได้และเชื่อมต่อกันผ่าน Network
@@ -301,6 +301,49 @@ src/
- [ ] **Deliverable:** Code อยู่ใน Version Control - [ ] **Deliverable:** Code อยู่ใน Version Control
- **Dependencies:** T0.2 (ต้องมี Project และโครงสร้างพื้นฐานก่อนจะ Commit) - **Dependencies:** T0.2 (ต้องมี Project และโครงสร้างพื้นฐานก่อนจะ Commit)
### **Phase 0: Testing - Infrastructure Validation**
#### **T0.T1 Database Connectivity Tests**
- [ ] **Unit Tests:**
- [ ] Test database connection configuration
- [ ] Test connection pooling settings
- [ ] Test connection error handling
- [ ] **Integration Tests:**
- [ ] Test actual database connection
- [ ] Test database migrations
- [ ] Test seed data loading
- [ ] Test backup/restore procedures
- [ ] **Performance Tests:**
- [ ] Test connection acquisition time < 100ms
- [ ] Test concurrent connections handling
- **Exit Criteria:** Database tests 100% passed
#### **T0.T2 Service Connectivity Tests**
- [ ] **Integration Tests:**
- [ ] Test Docker network connectivity
- [ ] Test inter-service communication
- [ ] Test Nginx proxy configuration
- [ ] Test SSL certificate setup
- [ ] **Security Tests:**
- [ ] Test firewall rules
- [ ] Test port exposure
- [ ] Test environment variables security
- **Exit Criteria:** All services can communicate securely
#### **T0.T3 Project Setup Tests**
- [ ] **Unit Tests:**
- [ ] Test NestJS project structure
- [ ] Test dependency configurations
- [ ] Test build process
- [ ] **Integration Tests:**
- [ ] Test Swagger documentation generation
- [ ] Test health check endpoints
- [ ] Test error handling setup
- **Exit Criteria:** Project setup verified and documented
--- ---
## **Phase 1: Core Foundation & Security (สัปดาห์ที่ 2-3)** ## **Phase 1: Core Foundation & Security (สัปดาห์ที่ 2-3)**
@@ -387,6 +430,63 @@ src/
- [ ] **Deliverable:** จัดการโครงสร้างโปรเจกต์ได้ - [ ] **Deliverable:** จัดการโครงสร้างโปรเจกต์ได้
- [ ] **Dependencies:** T1.1 (Base Entity, Security), T1.2 (สำหรับการป้องกันการเข้าถึง), T0.3 (ต้องเชื่อมต่อกับ project/organization tables) - [ ] **Dependencies:** T1.1 (Base Entity, Security), T1.2 (สำหรับการป้องกันการเข้าถึง), T0.3 (ต้องเชื่อมต่อกับ project/organization tables)
### **Phase 1: Testing - Core Foundation**
#### **T1.T1 Authentication Test Suite**
- [ ] **Unit Tests (25+ test cases):**
- [ ] AuthService.authenticate() - success and failure cases
- [ ] AuthService.validateUser() - various user states
- [ ] JWT token generation and validation
- [ ] Password hashing and verification
- [ ] Token refresh mechanism
- [ ] **Integration Tests (15+ test cases):**
- [ ] Complete login/logout flow
- [ ] Token expiration handling
- [ ] Concurrent session management
- [ ] Rate limiting on auth endpoints
- [ ] **Security Tests (10+ test cases):**
- [ ] SQL injection attempts on login
- [ ] Brute force attack simulation
- [ ] Token tampering attempts
- [ ] Session fixation tests
- [ ] **Performance Tests:**
- [ ] Login response time < 500ms under load
- [ ] Token validation < 50ms
- **Exit Criteria:** Authentication system secure and performant
#### **T1.T2 RBAC Test Suite**
- [ ] **Unit Tests (30+ test cases):**
- [ ] RbacGuard - all 4 permission levels
- [ ] Permission hierarchy logic
- [ ] Role-permission mappings
- [ ] Scope-based access control
- [ ] **Integration Tests (20+ test cases):**
- [ ] End-to-end permission checks
- [ ] Multi-organization access control
- [ ] Project/contract scope isolation
- [ ] Permission escalation attempts
- [ ] **Security Tests (15+ test cases):**
- [ ] Unauthorized access attempts
- [ ] Privilege escalation attempts
- [ ] Role manipulation attempts
- **Exit Criteria:** RBAC system working correctly for all scenarios
#### **T1.T3 User Management Test Suite**
- [ ] **Unit Tests (20+ test cases):**
- [ ] User CRUD operations
- [ ] Role assignment logic
- [ ] Soft delete functionality
- [ ] User search and filtering
- [ ] **Integration Tests (15+ test cases):**
- [ ] User creation with role assignment
- [ ] User deactivation workflow
- [ ] Bulk user operations
- [ ] User permission inheritance
- **Exit Criteria:** User management complete and secure
--- ---
## **Phase 2: Security & File Management (สัปดาห์ที่ 4)** ## **Phase 2: Security & File Management (สัปดาห์ที่ 4)**
@@ -510,6 +610,64 @@ src/
- [ ] Compress large audit data - [ ] Compress large audit data
- [ ] **Deliverable:** JSON details integrated กับทุก modules - [ ] **Deliverable:** JSON details integrated กับทุก modules
### **Phase 2: Testing - Security & File Management**
#### **T2.T1 File Upload Security Test Suite**
- [ ] **Unit Tests (15+ test cases):**
- [ ] File type validation (white-list)
- [ ] File size validation
- [ ] Virus scanning integration
- [ ] Checksum generation
- [ ] **Integration Tests (10+ test cases):**
- [ ] Complete file upload flow
- [ ] File download with access control
- [ ] Concurrent file operations
- [ ] File cleanup procedures
- [ ] **Security Tests (20+ test cases):**
- [ ] Malicious file upload attempts
- [ ] Path traversal attacks
- [ ] File type spoofing
- [ ] Access control bypass attempts
- [ ] **Performance Tests:**
- [ ] File upload < 30s for 50MB files
- [ ] Concurrent upload handling
- **Exit Criteria:** File system secure and performant
#### **T2.T2 JSON Schema Test Suite**
- [ ] **Unit Tests (25+ test cases):**
- [ ] JSON schema validation
- [ ] Schema versioning
- [ ] Data transformation
- [ ] Default value population
- [ ] **Integration Tests (15+ test cases):**
- [ ] End-to-end JSON processing
- [ ] Schema migration scenarios
- [ ] Error handling and recovery
- [ ] Backward compatibility
- [ ] **Security Tests (10+ test cases):**
- [ ] JSON injection attempts
- [ ] Schema manipulation
- [ ] Large payload attacks
- **Exit Criteria:** JSON system robust and secure
#### **T2.T3 Document Numbering Test Suite**
- [ ] **Unit Tests (10+ test cases):**
- [ ] Redis locking mechanism
- [ ] Number generation logic
- [ ] Retry mechanism
- [ ] Error scenarios
- [ ] **Integration Tests (8+ test cases):**
- [ ] Concurrent number generation
- [ ] Database transaction handling
- [ ] Failure recovery
- [ ] **Performance Tests:**
- [ ] Number generation < 100ms under load
- [ ] Concurrent request handling
- **Exit Criteria:** Document numbering system race-condition free
--- ---
## **Phase 3: Correspondence & RFA Core (สัปดาห์ที่ 5-6)** ## **Phase 3: Correspondence & RFA Core (สัปดาห์ที่ 5-6)**
@@ -632,6 +790,59 @@ src/
- [ ] **Security:** Implement permission checks สำหรับ routing operations - [ ] **Security:** Implement permission checks สำหรับ routing operations
- [ ] **Deliverable:** ระบบส่งต่อเอกสารทำงานได้สมบูรณ์ - [ ] **Deliverable:** ระบบส่งต่อเอกสารทำงานได้สมบูรณ์
### **Phase 3: Testing - Correspondence & Routing**
#### **T3.T1 Correspondence Test Suite**
- [ ] **Unit Tests (30+ test cases):**
- [ ] Correspondence creation with auto-numbering
- [ ] Revision management
- [ ] Status transitions
- [ ] Recipient management
- [ ] **Integration Tests (25+ test cases):**
- [ ] Complete correspondence lifecycle
- [ ] File attachment handling
- [ ] Reference management
- [ ] Search and filtering
- [ ] **Business Logic Tests (20+ test cases):**
- [ ] Workflow state validation
- [ ] Permission-based access
- [ ] Data validation rules
- [ ] Business rule enforcement
- **Exit Criteria:** Correspondence system handles all business scenarios
#### **T3.T2 Routing Test Suite**
- [ ] **Unit Tests (25+ test cases):**
- [ ] Template management
- [ ] Step sequencing
- [ ] Due date calculation
- [ ] Status transitions
- [ ] **Integration Tests (20+ test cases):**
- [ ] Complete routing workflow
- [ ] Multi-organization routing
- [ ] Deadline management
- [ ] Notification triggers
- [ ] **Edge Case Tests (15+ test cases):**
- [ ] Parallel processing scenarios
- [ ] Step skipping conditions
- [ ] Escalation procedures
- [ ] Error recovery
- **Exit Criteria:** Routing system handles complex workflows
#### **T3.T3 JSON Details Integration Test Suite**
- [ ] **Integration Tests (15+ test cases):**
- [ ] RFI details validation and processing
- [ ] RFA details for different types
- [ ] Transmittal details management
- [ ] Routing details in workflows
- [ ] **Data Migration Tests (10+ test cases):**
- [ ] Schema version upgrades
- [ ] Data transformation scenarios
- [ ] Backward compatibility
民主- **Exit Criteria:** JSON details integrated across all modules
--- ---
## **Phase 4: Drawing Management (สัปดาห์ที่ 7)** ## **Phase 4: Drawing Management (สัปดาห์ที่ 7)**
@@ -831,7 +1042,37 @@ src/
**Milestone:** ทดสอบและปรับปรุงประสิทธิภาพพร้อม Security Audit **Milestone:** ทดสอบและปรับปรุงประสิทธิภาพพร้อม Security Audit
### **Phase 7: Tasks** ### **Phase 7: Tasks- Testing Automation & CI/CD**
- [ ] **Setup Test Environment:**
- [ ] Dockerized test database
- [ ] Test Redis instance
- [ ] Mock external services
- [ ] Test data management
- [ ] **CI/CD Pipeline:**
- [ ] GitHub Actions workflow
- [ ] Automated test execution
- [ ] Test reporting and metrics
- [ ] Quality gates
- **Test Quality Gates**
```yaml
# GitHub Actions Quality Gates
quality_gates:
unit_tests:
coverage: 80%
required: true
integration_tests:
scenarios: all_core
required: true
security_tests:
vulnerabilities: 0
required: true
performance_tests:
response_time: 200ms
required: true
```
- **[ ] T7.1 Unit Testing** - **[ ] T7.1 Unit Testing**
- [ ] เขียน Unit Tests สำหรับ Services สำคัญ: - [ ] เขียน Unit Tests สำหรับ Services สำคัญ:
@@ -909,6 +1150,36 @@ src/
- [ ] **Deliverable:** Response Time < 200ms (90th percentile) - [ ] **Deliverable:** Response Time < 200ms (90th percentile)
- [ ] **Dependencies:** T7.4 (ผลจาก Performance Testing จะบอกว่าจุดไหนต้อง Optimization) - [ ] **Dependencies:** T7.4 (ผลจาก Performance Testing จะบอกว่าจุดไหนต้อง Optimization)
### 📊 **Testing Metrics & Exit Criteria**
**แต่ละ Phase ต้องผ่าน Metrics เหล่านี้:**
#### **Phase Completion Metrics**
- [ ] **Code Quality Metrics**
- [ ] Unit test coverage: ≥ 80%
- [ ] Integration test coverage: 100% core scenarios
- [ ] Static analysis: 0 critical issues
- [ ] Code duplication: < 5%
- [ ] **Performance Metrics**
- [ ] API response time: < 200ms (90th percentile)
- [ ] Database query performance: < 100ms
- [ ] Memory usage: Within limits
- [ ] Concurrent users: Meets targets
- [ ] **Security Metrics**
- [ ] Security vulnerabilities: 0
- [ ] Authentication tests: 100% passed
- [ ] Authorization tests: 100% passed
- [ ] Data validation tests: 100% passed
- [ ] **Business Metrics**
- [ ] Core workflows: 100% tested
- [ ] Edge cases: Covered
- [ ] Error scenarios: Handled appropriately
- [ ] User acceptance: Meets requirements
--- ---
## **Phase 8: Documentation & Deployment (สัปดาห์ที่ 14)** ## **Phase 8: Documentation & Deployment (สัปดาห์ที่ 14)**

View File

@@ -72,6 +72,58 @@
* จำลอง (Mock) การพึ่งพาภายนอก (external dependencies) * จำลอง (Mock) การพึ่งพาภายนอก (external dependencies)
* เพิ่ม **acceptance tests** ต่อโมดูลโดยใช้รูปแบบ GivenWhen-Then * เพิ่ม **acceptance tests** ต่อโมดูลโดยใช้รูปแบบ GivenWhen-Then
### **Testing Strategy โดยละเอียด**
* **Test Pyramid Structure**
/\
/ \ E2E Tests (10%)
/____\ Integration Tests (20%)
/ \ Unit Tests (70%)
/________\
* **Testing Tools Stack**
```typescript
// Backend Testing Stack
const backendTesting = {
unit: ['Jest', 'ts-jest', '@nestjs/testing'],
integration: ['Supertest', 'Testcontainers', 'Jest'],
e2e: ['Supertest', 'Jest', 'Database Seeds'],
security: ['Jest', 'Custom Security Test Helpers'],
performance: ['Jest', 'autocannon', 'artillery']
};
// Frontend Testing Stack
const frontendTesting = {
unit: ['Vitest', 'React Testing Library'],
integration: ['React Testing Library', 'MSW'],
e2e: ['Playwright', 'Jest'],
visual: ['Playwright', 'Loki']
};
```
* **Test Data Managemen**
```typescript
// Test Data Factories
interface TestDataFactory {
createUser(overrides?: Partial<User>): User;
createCorrespondence(overrides?: Partial<Correspondence>): Correspondence;
createRoutingTemplate(overrides?: Partial<RoutingTemplate>): RoutingTemplate;
}
// Test Scenarios
const testScenarios = {
happyPath: 'Normal workflow execution',
edgeCases: 'Boundary conditions and limits',
errorConditions: 'Error handling and recovery',
security: 'Authentication and authorization',
performance: 'Load and stress conditions'
};
```
## 🏗️**3. แบ็กเอนด์ (NestJS) (Backend (NestJS))** ## 🏗️**3. แบ็กเอนด์ (NestJS) (Backend (NestJS))**
### **3.1 หลักการ** ### **3.1 หลักการ**
@@ -1003,6 +1055,458 @@ export class JsonSchemaController {
} }
``` ```
* **Correspondence Revision Details**
* Generic Correspondence Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "CORRESPONDENCE",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"content": {
"subject": "เรื่องขออนุญาตดำเนินงาน",
"description": "รายละเอียดเพิ่มเติมเกี่ยวกับเอกสาร",
"priority": "HIGH",
"confidentiality": "INTERNAL",
"references": [
{
"type": "RELATED",
"correspondence_id": 123,
"description": "เอกสารเกี่ยวข้อง"
}
]
},
"attachments_metadata": {
"main_documents": [
{
"attachment_id": 456,
"filename": "main_document.pdf",
"description": "เอกสารหลัก"
}
],
"supporting_documents": [
{
"attachment_id": 457,
"filename": "supporting_data.xlsx",
"description": "ข้อมูลประกอบ"
}
]
}
}
```
* RFI (Request for Information) Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "RFI",
"rfi_category": "TECHNICAL",
"urgency": "NORMAL"
},
"questions": [
{
"question_id": 1,
"question_text": "ต้องการทราบรายละเอียด specification ของ material",
"reference_drawing": "DRG-2024-001",
"response_required": true,
"deadline": "2024-01-25T17:00:00Z"
},
{
"question_id": 2,
"question_text": "ขอทราบวิธีการติดตั้ง",
"response_required": false,
"clarification_needed": true
}
],
"technical_details": {
"discipline": "CIVIL",
"related_drawings": ["DRG-2024-001", "DRG-2024-002"],
"specification_references": ["SPEC-CIV-001", "SPEC-CIV-005"]
}
}
```
* Transmittal Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "TRANSMITTAL",
"purpose": "FOR_APPROVAL",
"transmittal_category": "SHOP_DRAWING"
},
"items": [
{
"item_number": 1,
"correspondence_id": 123,
"description": "Shop Drawing - Structural Plan",
"revision": "A",
"quantity": 3,
"remarks": "สำหรับตรวจสอบและอนุมัติ"
},
{
"item_number": 2,
"correspondence_id": 124,
"description": "Calculation Sheet",
"revision": "0",
"quantity": 2,
"remarks": "ประกอบการพิจารณา"
}
],
"delivery_info": {
"method": "ELECTRONIC",
"carrier": null,
"tracking_number": null,
"expected_delivery": "2024-01-16T09:00:00Z"
}
}
```
* **Routing Details**
* Routing Template Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "ROUTING_TEMPLATE",
"scope": "PROJECT_SPECIFIC",
"applicable_projects": ["LCBP3", "LCBP3-SUB1"],
"created_by": 101,
"last_modified": "2024-01-10T14:20:00Z"
},
"workflow_rules": {
"allow_parallel_processing": false,
"allow_step_skipping": true,
"require_approval_before_next": true,
"escalation_rules": {
"overdue_action": "NOTIFY_SUPERVISOR",
"overdue_days": 3,
"escalation_recipients": [201, 202]
}
},
"step_configurations": [
{
"sequence": 1,
"conditional_logic": {
"condition": "DOCUMENT_TYPE == 'RFA'",
"action": "AUTO_ASSIGN_TO_PROJECT_MANAGER"
},
"auto_actions": {
"on_receive": "CALCULATE_DUE_DATE",
"on_approve": "NOTIFY_NEXT_STEP",
"on_reject": "RETURN_TO_ORIGINATOR"
}
}
]
}
```
* Routing Instance Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "ROUTING_INSTANCE",
"template_id": 15,
"initiated_by": 101,
"started_at": "2024-01-15T10:30:00Z"
},
"current_status": {
"current_step": 2,
"overall_progress": 50,
"estimated_completion": "2024-01-22T17:00:00Z",
"blocked_reason": null
},
"step_history": [
{
"step_sequence": 1,
"organization_id": 301,
"assigned_to": 201,
"assigned_at": "2024-01-15T10:30:00Z",
"status": "COMPLETED",
"completed_at": "2024-01-16T09:15:00Z",
"action_taken": "APPROVED",
"comments": "ตรวจสอบแล้วเห็นควรดำเนินการต่อ",
"processing_time_hours": 22.75,
"attachments_added": [501, 502]
},
{
"step_sequence": 2,
"organization_id": 302,
"assigned_to": null,
"assigned_at": "2024-01-16T09:15:00Z",
"status": "IN_PROGRESS",
"due_date": "2024-01-19T17:00:00Z",
"time_remaining_hours": 72,
"reminders_sent": 0
}
],
"performance_metrics": {
"total_processing_time": 22.75,
"average_step_time": 22.75,
"steps_completed": 1,
"steps_pending": 2,
"on_track": true
}
}
```
* Routing Step Action Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "ROUTING_ACTION",
"action_type": "APPROVE_WITH_COMMENTS",
"performed_by": 201,
"performed_at": "2024-01-16T09:15:00Z"
},
"action_details": {
"decision": "APPROVED",
"approval_code": "1A",
"conditions": [
{
"condition_id": 1,
"description": "ต้องส่งแบบแก้ไขก่อนเริ่มงาน",
"deadline": "2024-01-20T17:00:00Z"
}
],
"remarks": "แบบแปลนถูกต้องตามข้อกำหนด แต่ต้องแก้ไขรายละเอียดการติดตั้ง"
},
"technical_review": {
"compliance_status": "COMPLIANT",
"exceptions": [
{
"item": "Material Specification",
"issue": "ไม่ได้ระบุ brand ที่ต้องการ",
"severity": "LOW",
"recommendation": "เพิ่มรายละเอียด brand ที่อนุญาต"
}
],
"reviewer_comments": "โดยรวมเป็นไปตามข้อกำหนดของโครงการ"
},
"attachments": {
"review_documents": [503],
"reference_standards": ["ASTM-A36", "JIS-G3101"]
},
"next_steps": {
"auto_assign_to": 202,
"required_actions": ["UPDATE_DRAWING", "RESUBMIT"],
"deadline_extension_days": 5
}
}
```
* **Audit & Security Details**
* Audit Log Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "AUDIT_LOG",
"security_level": "SENSITIVE"
},
"action_context": {
"ip_address": "192.168.1.100",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"session_id": "sess_abc123def456",
"request_id": "req_789ghi012jkl"
},
"changes_made": {
"before": {
"status": "DRAFT",
"title": "ร่างเอกสารขออนุมัติ"
},
"after": {
"status": "SUBMITTED",
"title": "เอกสารขออนุมัติแบบก่อสร้าง"
},
"fields_modified": ["status", "title"]
},
"security_metadata": {
"authentication_method": "JWT",
"permissions_checked": ["correspondence.update", "workflow.submit"],
"risk_level": "LOW",
"compliance_checked": true
}
}
```
* File Upload Security Details
```typescript
{
"metadata": {
"version": "1.0",
"type": "FILE_SECURITY_SCAN",
"scan_timestamp": "2024-01-15T10:35:22Z"
},
"scan_results": {
"virus_scan": {
"engine": "ClamAV",
"version": "1.0.1",
"status": "CLEAN",
"signatures": "20240115001",
"scan_duration_ms": 245
},
"file_validation": {
"expected_type": "application/pdf",
"detected_type": "application/pdf",
"file_size_bytes": 2547896,
"checksum_sha256": "a1b2c3d4e5f6789012345678901234567890123456789012345678901234",
"validation_passed": true
},
"security_assessment": {
"risk_level": "LOW",
"threats_detected": [],
"recommendations": ["None"]
}
},
"access_control": {
"uploaded_by": 101,
"organization_id": 301,
"allowed_roles": ["VIEWER", "EDITOR", "DOCUMENT_CONTROL"],
"download_count": 0,
"last_accessed": null
}
}
```
* **Reporting & Analytics Details**
* Correspondence Statistics
```typescript
{
"metadata": {
"version": "1.0",
"type": "CORRESPONDENCE_STATS",
"period": "MONTHLY",
"generated_at": "2024-01-31T23:59:59Z"
},
"summary": {
"total_correspondences": 156,
"new_this_period": 45,
"closed_this_period": 38,
"outstanding": 67
},
"by_type": {
"RFA": {
"count": 89,
"approval_rate": 72.5,
"average_processing_days": 12.3
},
"RFI": {
"count": 45,
"response_rate": 95.6,
"average_response_hours": 48.2
},
"LETTER": {
"count": 22,
"action_required": 15,
"pending_actions": 8
}
},
"performance_metrics": {
"on_time_completion_rate": 78.4,
"average_cycle_time_days": 8.7,
"escalation_count": 12,
"sla_violations": 5
}
}
```
* **Usage Guidelines**
* Schema Validation Rules
```typescript
{
"validation_rules": {
"required_fields": ["metadata.version", "metadata.type"],
"version_control": {
"current_version": "1.0",
"backward_compatible": true
},
"size_limits": {
"max_json_size_kb": 50,
"max_array_elements": 1000
},
"data_types": {
"timestamps": "ISO8601",
"numbers": "integer_or_float",
"enums": "predefined_values"
}
}
}
```
* Example TypeScript Interfaces
```typescript
interface CorrespondenceDetails {
metadata: {
version: string;
type: string;
created_at: string;
updated_at: string;
};
content: {
subject: string;
description?: string;
priority: 'LOW' | 'NORMAL' | 'HIGH' | 'URGENT';
confidentiality: 'PUBLIC' | 'INTERNAL' | 'CONFIDENTIAL';
references?: Array<{
type: string;
correspondence_id: number;
description: string;
}>;
};
}
interface RoutingInstanceDetails {
metadata: {
version: string;
type: string;
template_id: number;
initiated_by: number;
started_at: string;
};
current_status: {
current_step: number;
overall_progress: number;
estimated_completion: string;
blocked_reason: string | null;
};
step_history: Array<{
step_sequence: number;
organization_id: number;
assigned_to: number | null;
assigned_at: string;
status: string;
completed_at?: string;
action_taken?: string;
comments?: string;
processing_time_hours?: number;
}>;
}
```
## 🧩**12. การปรับปรุงที่แนะนำ (สำหรับอนาคต) (Recommended Enhancements (Future))** ## 🧩**12. การปรับปรุงที่แนะนำ (สำหรับอนาคต) (Recommended Enhancements (Future))**
* ✅ สร้าง Background job (โดยใช้ **n8n** เพื่อเชื่อมต่อกับ **Line** [cite: 2.7] และ/หรือใช้สำหรับการแจ้งเตือน RFA ที่ใกล้ถึงกำหนด due_date [cite: 6.7]) * ✅ สร้าง Background job (โดยใช้ **n8n** เพื่อเชื่อมต่อกับ **Line** [cite: 2.7] และ/หรือใช้สำหรับการแจ้งเตือน RFA ที่ใกล้ถึงกำหนด due_date [cite: 6.7])

View File

@@ -21,7 +21,7 @@
- Server: QNAP (Model: TS-473A, RAM: 32GB, CPU: AMD Ryzen V1500B) - Server: QNAP (Model: TS-473A, RAM: 32GB, CPU: AMD Ryzen V1500B)
- Containerization: Container Station (Docker & Docker Compose) ใช้ UI ของ Container Station เป็นหลัก ในการ configuration และการรัน docker command - Containerization: Container Station (Docker & Docker Compose) ใช้ UI ของ Container Station เป็นหลัก ในการ configuration และการรัน docker command
- Development Environment: VS Code on Windows 11 - Development Environment: VS Code on Windows 11
- Domain: np-dms.work, www.np-dms.work - Domain: np-dms.work, <www.np-dms.work>
- ip: 159.192.126.103 - ip: 159.192.126.103
- Docker Network: ทุก Service จะเชื่อมต่อผ่านเครือข่ายกลางชื่อ lcbp3 เพื่อให้สามารถสื่อสารกันได้ - Docker Network: ทุก Service จะเชื่อมต่อผ่านเครือข่ายกลางชื่อ lcbp3 เพื่อให้สามารถสื่อสารกันได้
- Data Storage: /share/dms-data บน QNAP - Data Storage: /share/dms-data บน QNAP
@@ -587,6 +587,44 @@
--- ---
## **10. ข้อกำหนดด้าน Testing Strategy**
### **10.1 Testing Gates แต่ละ Phase**
ทุก Phase ต้องผ่านการทดสอบต่อไปนี้ก่อนดำเนินการ Phase ถัดไป:
#### **10.1.1 Unit Testing Requirements**
- Code coverage อย่างน้อย 80% สำหรับ components ที่พัฒนาใน Phase
- ทดสอบ business logic ทั้งหมด
- ทดสอบ error scenarios และ edge cases
#### **10.1.2 Integration Testing Requirements**
- ทดสอบการทำงานร่วมกันของ modules ใน Phase
- ทดสอบ database operations
- ทดสอบ external service integrations
#### **10.1.3 Security Testing Requirements**
- ทดสอบ security vulnerabilities
- ทดสอบ permission และ access control
- ทดสอบ input validation
#### **10.1.4 Performance Testing Requirements**
- ทดสอบ response time ตามเป้าหมาย
- ทดสอบภายใต้ load ที่คาดหมาย
- ทดสอบ memory usage และ resource utilization
### **10.2 Testing Automation**
- ต้องมี automated test pipelines
- ต้องมี test reports และ metrics
- ต้องมี regression testing
---
## **📋 สรุปการปรับปรุงจากเวอร์ชันก่อนหน้า** ## **📋 สรุปการปรับปรุงจากเวอร์ชันก่อนหน้า**
### **Security Enhancements:** ### **Security Enhancements:**