260317:0837 Refactor to n8n
Build and Deploy / deploy (push) Successful in 7m11s

This commit is contained in:
admin
2026-03-17 08:37:01 +07:00
parent 4f7d9bb80c
commit 2f0d67d8b2
18 changed files with 475 additions and 241 deletions
@@ -23,8 +23,9 @@ CREATE TABLE IF NOT EXISTS migration_progress (
CREATE TABLE IF NOT EXISTS migration_review_queue (
id INT AUTO_INCREMENT PRIMARY KEY,
document_number VARCHAR(100) NOT NULL,
title TEXT,
original_title TEXT,
subject TEXT COMMENT 'หัวข้อเรื่อง (ตรงกับ correspondence_revisions.subject)',
original_subject TEXT COMMENT 'หัวข้อเดิมจาก Excel (ก่อน AI แก้ไข)',
body TEXT NULL COMMENT 'เนื้อความสรุปจาก AI (เตรียมนำเข้า correspondence_revisions.body)',
project_id INT NULL COMMENT 'Project ID จาก Lookups',
sender_organization_id INT NULL COMMENT 'Sender ID จาก Lookups',
receiver_organization_id INT NULL COMMENT 'Receiver ID จาก Lookups',
@@ -54,6 +55,8 @@ CREATE TABLE IF NOT EXISTS migration_errors (
document_number VARCHAR(100),
error_type ENUM(
'FILE_NOT_FOUND',
'MISSING_FILENAME',
'FILE_ERROR',
'AI_PARSE_ERROR',
'API_ERROR',
'DB_ERROR',
@@ -1,8 +1,8 @@
# Frontend Development Guidelines
**สำหรับ:** NAP-DMS LCBP3 Frontend (Next.js + TypeScript)
**เวอร์ชัน:** 1.5.0
**อัปเดต:** 2025-12-01
**สำหรับ:** NAP-DMS LCBP3 Frontend (Next.js 16 + TypeScript)
**เวอร์ชัน:** 1.8.1
**อัปเดต:** 2026-03-16
---
@@ -45,7 +45,7 @@ frontend/
├── public/ # Static assets
├── styles/ # Global styles
├── types/ # TypeScript types & DTOs
└── middleware.ts # Next.js Middleware
└── proxy.ts # Next.js Proxy (renamed from middleware.ts in Next.js 16)
```
---
+8 -8
View File
@@ -10,9 +10,9 @@
| Attribute | Value |
| ------------------ | -------------------------------- |
| **Version** | 1.8.0 |
| **Version** | 1.8.1 |
| **Status** | Active |
| **Last Updated** | 2026-02-24 |
| **Last Updated** | 2026-03-16 |
| **Owner** | Nattanin Peancharoen |
| **Classification** | Internal Technical Documentation |
@@ -50,7 +50,7 @@
## 📖 คู่มือการพัฒนา (Implementation Guides)
### 1. [FullStack JS Guidelines](./05-01-fullstack-js-guidelines.md)
**แนวทางการพัฒนาภาพรวมทั้งระบบ (v1.8.0)**
**แนวทางการพัฒนาภาพรวมทั้งระบบ (v1.8.1 — includes NestJS 11 Patterns)**
- โครงสร้างโปรเจกต์ (Monorepo-like focus)
- Naming Conventions & Code Style
- Secrets & Environment Management
@@ -58,7 +58,7 @@
- Double-Lock Mechanism for Numbering
### 2. [Backend Guidelines](./05-02-backend-guidelines.md)
**แนวทางการพัฒนา NestJS Backend**
**แนวทางการพัฒนา NestJS 11 Backend**
- Modular Architecture Detail
- DTO Validation & Transformer
- TypeORM Best Practices & Optimistic Locking
@@ -66,7 +66,7 @@
- BullMQ for Background Jobs
### 3. [Frontend Guidelines](./05-03-frontend-guidelines.md)
**แนวทางการพัฒนา Next.js Frontend**
**แนวทางการพัฒนา Next.js 16 Frontend**
- App Router Patterns
- Shadcn/UI & Tailwind Styling
- TanStack Query for Data Fetching
@@ -97,8 +97,8 @@
| Layer | Primary Technology | Secondary/Supporting |
| ------------ | ------------------ | -------------------- |
| **Backend** | NestJS (Node.js) | TypeORM, BullMQ |
| **Frontend** | Next.js 14+ | Shadcn/UI, Tailwind |
| **Backend** | NestJS 11 (Express v5) | TypeORM, BullMQ |
| **Frontend** | Next.js 16 (React 19) | Shadcn/UI, Tailwind |
| **Database** | MariaDB 11.8 | Redis 7 (Cache/Lock) |
| **Search** | Elasticsearch | - |
| **Testing** | Jest, Vitest | Playwright |
@@ -115,7 +115,7 @@
<div align="center">
**LCBP3-DMS Implementation Specification v1.8.0**
**LCBP3-DMS Implementation Specification v1.8.1**
[FullStack](./05-01-fullstack-js-guidelines.md) • [Backend](./05-02-backend-guidelines.md) • [Frontend](./05-03-frontend-guidelines.md) • [Testing](./05-04-testing-strategy.md)
+14 -4
View File
@@ -1,7 +1,7 @@
# Architecture Decision Records (ADRs)
**Version:** 1.8.0
**Last Updated:** 2026-02-24
**Version:** 1.8.1
**Last Updated:** 2026-03-16
**Project:** LCBP3-DMS (Laem Chabang Port Phase 3 - Document Management System)
---
@@ -43,7 +43,7 @@ Architecture Decision Records (ADRs) เป็นเอกสารที่บ
| ADR | Title | Status | Date | Summary |
| --------------------------------------------------- | ------------------------------------ | -------------------- | ---------- | ------------------------------------------------------------ |
| [ADR-005](./ADR-005-technology-stack.md) | Technology Stack Selection | ✅ Accepted | 2026-02-24 | Full Stack TypeScript: NestJS + Next.js + MariaDB + Redis |
| [ADR-005](./ADR-005-technology-stack.md) | Technology Stack Selection | ✅ Accepted | 2026-02-24 | Full Stack TypeScript: NestJS 11 + Next.js 16 + MariaDB + Redis |
| [ADR-006](./ADR-006-redis-caching-strategy.md) | Redis Usage & Caching Strategy | ✅ Accepted | 2026-02-24 | Redis สำหรับ Distributed Lock, Cache, Queue, และ Rate Limiting |
| [ADR-009](./ADR-009-database-migration-strategy.md) | Database Migration & Deployment | ✅ Accepted (Pending) | 2026-02-24 | TypeORM Migrations พร้อม Blue-Green Deployment |
| [ADR-015](./ADR-015-deployment-infrastructure.md) | Deployment & Infrastructure Strategy | ✅ Accepted | 2026-02-24 | Docker Compose with Blue-Green Deployment on QNAP |
@@ -69,6 +69,12 @@ Architecture Decision Records (ADRs) เป็นเอกสารที่บ
| [ADR-013](./ADR-013-form-handling-validation.md) | Form Handling & Validation | ✅ Accepted | 2026-02-24 | React Hook Form + Zod for Type-Safe Forms |
| [ADR-014](./ADR-014-state-management.md) | State Management Strategy | ✅ Accepted | 2026-02-24 | Zustand for Client State + Server Components |
### Data & Identity
| ADR | Title | Status | Date | Summary |
| ------------------------------------------------------------ | ---------------------------- | ---------- | ---------- | -------------------------------------------------------- |
| [ADR-019](./ADR-019-hybrid-identifier-strategy.md) | Hybrid Identifier Strategy | ✅ Accepted | 2026-03-11 | INT PK (internal) + UUIDv7 (public API) on 14 tables |
---
## 🔍 ADR Categories
@@ -91,7 +97,7 @@ Architecture Decision Records (ADRs) เป็นเอกสารที่บ
### 4. Infrastructure & Performance
- **ADR-005:** Technology Stack - TypeScript ecosystem
- **ADR-005:** Technology Stack - TypeScript ecosystem (NestJS 11, Next.js 16)
- **ADR-006:** Redis - Caching และ Distributed coordination
- **ADR-015:** Deployment - Docker Compose with Blue-Green Deployment
@@ -110,6 +116,10 @@ Architecture Decision Records (ADRs) เป็นเอกสารที่บ
- **ADR-013:** Form Handling - React Hook Form + Zod Validation
- **ADR-014:** State Management - Zustand + Server Components
### 8. Data & Identity
- **ADR-019:** Hybrid Identifier Strategy - INT PK (internal) + UUIDv7 (public API) บน 14 tables
---
## 📖 How to Read ADRs
+9 -5
View File
@@ -1,7 +1,7 @@
# 📚 LCBP3-DMS Specifications Directory
**Version:** 1.8.1 (Patch)
**Last Updated:** 2026-03-11
**Last Updated:** 2026-03-16
**Project:** LCBP3-DMS (Laem Chabang Port Phase 3 - Document Management System)
**Status:** ✅ UAT Ready — 10/10 Documentation Gaps Closed
@@ -68,16 +68,18 @@ specs/
│ └── README.md # Infrastructure & Operations Guide
├── 05-Engineering-Guidelines/ # มาตรฐานการพัฒนาและการเขียนโค้ด
│ ├── 05-01-fullstack-js-guidelines.md # JS/TS Guidelines รวมๆ
│ ├── 05-01-fullstack-js-guidelines.md # JS/TS Guidelines + NestJS 11 Patterns
│ ├── 05-02-backend-guidelines.md # NestJS Backend, Error Handling
│ ├── 05-03-frontend-guidelines.md # UI/UX, React Hook Form, State Strategy
│ ├── 05-04-testing-strategy.md # Unit/E2E Testing ยุทธศาสตร์
│ ├── 05-05-git-cheatsheet.md # การใช้ Git สำหรับทีมงาน
│ ├── 05-07-hybrid-uuid-implementation-plan.md # ADR-019 Implementation Guide
│ └── README.md # ภาพรวมเป้าหมายงาน Engineering
├── 06-Decision-Records/ # Architecture Decision Records (17 + 1 Patch)
├── 06-Decision-Records/ # Architecture Decision Records (17 + Patch + ADR-019)
│ ├── ADR-001 to ADR-017... # ไฟล์อธิบายสถาปัตยกรรม (ADR)
│ ├── ADR-018-ai-boundary.md # ★ Patch 1.8.1: AI/Ollama Isolation Policy
│ ├── ADR-019-hybrid-identifier-strategy.md # ★ Hybrid ID: INT PK + UUIDv7 Public API
│ └── README.md # รายชื่อ ADR ทั้งหมดพร้อมสถานะและวันที่
└── 99-archives/ # ประวัติการทำงานและ Tasks เก่า
@@ -122,6 +124,7 @@ specs/
| **UAT Criteria** | `01-Requirements/01-05-acceptance-criteria.md` | ตรวจความสมบูรณ์ Feature |
| **ADR-009** | `06-Decision-Records/ADR-009-db-strategy.md` | Schema Change Process |
| **ADR-018** | `06-Decision-Records/ADR-018-ai-boundary.md` | AI/Ollama Integration Rules |
| **ADR-019** | `06-Decision-Records/ADR-019-hybrid-identifier-strategy.md` | Hybrid ID Strategy (INT + UUIDv7) |
---
@@ -145,13 +148,13 @@ specs/
---
## 🏛️ ADR Reference (All 17 + 1 Patch)
## 🏛️ ADR Reference (All 17 + Patch + ADR-019)
| ADR | Topic | Key Decision |
|-----|-------|-------------|
| ADR-001 | Workflow Engine | Unified state machine for document workflows |
| ADR-002 | Doc Numbering | Redis Redlock + DB optimistic locking |
| ADR-005 | Technology Stack | NestJS + Next.js + MariaDB + Redis |
| ADR-005 | Technology Stack | NestJS 11 + Next.js 16 + MariaDB + Redis |
| ADR-006 | Redis Caching | Cache strategy and invalidation patterns |
| ADR-008 | Email Notification | BullMQ queue-based email/LINE/in-app |
| ADR-009 | DB Strategy | No TypeORM migrations — modify schema SQL directly |
@@ -164,5 +167,6 @@ specs/
| ADR-016 | Security | JWT + CASL RBAC + Helmet.js + ClamAV |
| ADR-017 | Ollama Migration | Local AI + n8n for legacy data import |
| ADR-018 ★ | AI Boundary (Patch 1.8.1) | AI isolation — no direct DB/storage access |
| ADR-019 ★ | Hybrid Identifier Strategy | INT PK (internal) + UUIDv7 (public API) |
> **Priority:** `06-Decision-Records` > `05-Engineering-Guidelines` > others