# Version History ## [Unreleased] ### Correspondence Module โ€” Phase 7 Complete (2026-03-24) #### ๐Ÿ“ง **Email Notification Wiring** (Phase 7.1) - **Changed**: Notification `type` on correspondence events: `'SYSTEM'` โ†’ `'EMAIL'` in 3 places - `correspondence.service.ts` โ€” cancel event - `correspondence-workflow.service.ts` โ€” submit event (recipient orgs) - `due-date-reminder.service.ts` โ€” due date cron - **Effect**: `NotificationProcessor` now also dispatches Nodemailer email (immediate or digest per user preference) alongside in-app + WebSocket push #### ๐Ÿงช **Unit Tests** (Phase 7.2) - **Backend** (`due-date-reminder.service.spec.ts` โ€” 8 tests): - No revisions โ†’ no notifications - Skip: no correspondence, CANCELLED, CLBOWN, no doc-control user found - Happy path: correct `userId`, `type: 'EMAIL'`, `link`, `entityId` - Error isolation: one failed revision doesn't stop others - `daysLeft` message format validation - **Frontend** (`hooks/__tests__/use-circulation.test.ts` โ€” 5 tests): - Cache key generation for `circulationKeys.byCorrespondence()` - Successful fetch, disabled when UUID empty, error handling, query key assertion #### ๐Ÿ“ฆ **Bulk Operations** (Phase 7.3) - **Backend**: `BulkCancelDto` (`uuids[]` + `reason`) โ†’ `POST /correspondences/bulk-cancel` (returns `{ succeeded[], failed[] }`) - **Backend**: `GET /correspondences/export-csv` โ€” streams UTF-8 BOM CSV with all filtered correspondence data - **Frontend**: **Export CSV** button in `/correspondences` filter bar โ€” respects active search/status/revision filters, triggers browser download ### Correspondence Module โ€” Phase 6 Complete (2026-03-24) #### ๐Ÿ”– **Tag Manager** (Phase 5 โ†’ 6 bridge) - **New Entity**: `CorrespondenceTag` (`correspondence_tags` junction table) โ€” composite PK, eager-loads `Tag` - **Backend**: `getTags()`, `addTag()`, `removeTag()` in `CorrespondenceService`; `GET/POST/DELETE /:uuid/tags` endpoints - **Frontend**: `correspondenceService.getTags/addTag/removeTag` โ†’ `useCorrespondenceTags`, `useAddTag`, `useRemoveTag` hooks โ†’ `TagManager` component in detail sidebar #### ๐Ÿ” **Search Enhancement** (Phase 6.1) - **Backend**: Added `status` filter to `SearchQueryDto` and `SearchService.search()` ES query - **Frontend**: `SearchFilters` now controlled (accepts `filters` prop), proper status codes (`SUBOWN`, `CLBOWN`, `CCBOWN`), active filter badge count - **Frontend**: Added pagination (Prev/Next) to `/search` page with `PAGE_SIZE = 20` - **Frontend**: Improved result cards โ€” type-colored icons, color-coded status badges, doc number prominence, correct drawing links #### ๐Ÿ”„ **Circulation Status Card** (Phase 6.2) - **Backend**: Added `correspondenceUuid` filter to `SearchCirculationDto`; `findAll` now joins correspondence + routings when filtering by UUID - **Frontend**: `circulationService.getByCorrespondenceUuid()` โ†’ `useCirculationsByCorrespondence` hook โ†’ `CirculationStatusCard` component showing per-circulation status + routing assignees in correspondence detail sidebar #### ๐Ÿ“œ **Revision History UI** (Phase 6.3) - **Frontend**: `RevisionHistory` component โ€” vertical timeline showing all revisions sorted desc, active revision marker, color-coded status, date + remarks; rendered from existing `data.revisions` (no new endpoint needed) #### โฐ **Due Date Reminder Cron** (Phase 6.4) - **Backend**: Registered `ScheduleModule.forRoot()` in `AppModule` - **Backend**: `DueDateReminderService` โ€” `@Cron(EVERY_DAY_AT_8AM)` queries revisions where `dueDate` between now and +3 days, skips CANCELLED/CLBOWN, sends in-app notification via `NotificationService` with link to correspondence ### CI/CD & Deployment Simplification (2026-03-24) #### ๐Ÿš€ **deploy.sh v2.0 โ€” Rewrote deployment script** - **Changed**: Replaced 9-step blue-green deployment with 3-step direct deploy - **Step 1**: Build Docker images (backend + frontend) from source - **Step 2**: `docker compose -f [compose_file] up -d --force-recreate` - **Step 3**: Health check on `backend` container - **Removed**: Blue/green directory switching, NGINX switching, `current` file tracking - **Reason**: QNAP setup uses a single stack โ€” simultaneous blue/green was not viable with shared container names #### โš™๏ธ **ci-deploy.yml โ€” CI pipeline improvements** - **Added**: `pnpm/action-setup@v4` + `cache: 'pnpm'` for faster installs - **Fixed**: `--watchAll=false` removed from backend test command (not a valid Jest flag) - **Fixed**: `mkdir -p /share/np-dms/app/logs` before deploy to prevent `tee` error - **Simplified**: Removed `tee` + `PIPESTATUS` โ€” `set -e` handles errors ### Document Numbering System Fixes (2026-03-21) #### ๐Ÿ”ข **Template Management Hardening** - **Issue**: Save/Edit functionality failing due to missing fields and data complexity. - **Fix (Backend)**: Added `disciplineId` and `isActive` to `DocumentNumberFormat` entity. - **Fix (Backend)**: Implemented automated "Upsert" logic in `DocumentNumberingService` to handle business keys (Project + Type + Discipline). - **Fix (Frontend)**: Refactored `numberingApi.saveTemplate` to sanitize DTOs and avoid sending nested relation objects. - **Feature**: Added **Discipline** selection to the Template Editor UI for granular numbering rules. - **Result**: Administrators can now successfully create, update, and manage numbering templates globally or per discipline. ### Build & Deployment Fixes (2026-03-20) #### ๐Ÿ”ง **Backend Dependency Resolution** - **Issue**: `ms` package not found during build - **Fix**: Added `"ms": "^2.1.3"` to dependencies and `"@types/ms": "^2.1.0"` to devDependencies - **Issue**: `CACHE_MANAGER` not available in UserModule and AuthModule - **Fix**: Added global `CacheModule.register({ isGlobal: true, ttl: 300 })` to AppModule - **Issue**: `UuidResolverService` not available despite `@Global()` decorator - **Fix**: Added `CommonModule` import to AppModule to initialize global services - **Result**: Backend starts successfully with all dependencies resolved #### ๐Ÿณ **Docker Build Fixes** - **Issue**: Next.js standalone build failed with pnpm symlink structure - **Error**: `ENOENT: no such file or directory` creating standalone node_modules - **Fix**: Temporarily disabled `output: "standalone"` in next.config.mjs - **Fix**: Updated Dockerfile to copy full app and node_modules instead of standalone output - **Result**: Frontend builds successfully in Docker (slightly larger image) #### ๐Ÿ“ฆ **Cache Architecture Update** - **Before**: Local CacheModule imports in UserModule and AuthModule - **After**: Global CacheModule in AppModule (TTL 5 minutes, in-memory) - **Benefit**: All services (UserService, AuthService, JwtStrategy, IdempotencyInterceptor, MaintenanceModeGuard) can inject CACHE_MANAGER - **Note**: Temporary solution until Redis store TypeScript issues are resolved ### Frontend Quality Refactor Pass (2026-03-20) #### ๐Ÿ”ง **ESLint Hardening** - Added `@typescript-eslint/no-explicit-any` as warning for TypeScript files - Added `no-console` as warning for TypeScript files - Added `eslint-plugin-react-hooks` rules (rules-of-hooks: error, exhaustive-deps: warn) #### ๐Ÿงน **Eliminate `any` Types (69 โ†’ 4)** - **admin pages**: Replaced `(projects as any[])` with typed `{ id?; uuid?; projectCode; projectName }` casts (6 pages) - **drawings/upload-form.tsx**: Fixed discriminated union form errors with `Record` - **generic-crud-table.tsx**: Added `ApiError` interface, replaced `any` with `Record` generics - **numbering components**: Updated `projectId` prop types to `number | string`, coerced with `Number()` - **numbering/page.tsx**: Defined `ProjectItem` interface, typed find/filter operations - **admin/user-dialog.tsx**: Typed roles, organizations, and mutation payloads with `CreateUserDto` - **admin/security/rbac-matrix.tsx**: Typed API responses with explicit `Role[]` / `Permission[]` return types - **numbering/template-tester.tsx**: Typed template project access, fixed `error: any` โ†’ `error: unknown` - **numbering/template-editor.tsx**: Typed correspondence type lookup - **rfas/detail.tsx**: Created `RFADetailData` / `RFADetailItem` interfaces - **rfas/form.tsx**: Added `items` to `CreateRfaDto`, aligned DTO imports - **correspondences/form.tsx**: Fixed `defaultValues as any` โ†’ `as FormData` - **correspondences-content.tsx**: Removed `as any` on `useCorrespondences` params - **drawings/list.tsx**: Replaced `as any` with `as DrawingSearchParams` - **auth/auth-sync.tsx**: Typed NextAuth session user with explicit interface - **migration/review/[id]/page.tsx**: Fixed `error: any` โ†’ `error: unknown` with typed response cast - **reference pages** (disciplines, rfa-types, tags): Typed `fetchFn` mapping and `createFn` casts - **Remaining 4**: All `zodResolver(formSchema) as any` โ€” known zod 4 + @hookform/resolvers compat (marked with `eslint-disable`) #### ๐Ÿ”‡ **Remove Production Console Logs (53 โ†’ 4)** - Removed all `console.log`, `console.warn`, `console.error` from production code - **Kept**: 4 Next.js error boundary files (`error.tsx`, `global-error.tsx`) โ€” required by framework - **Replaced**: Redundant catch-block logging where `toast` already provides user feedback - **Files cleaned**: `lib/auth.ts`, `lib/api/client.ts`, `lib/api/numbering.ts`, `lib/services/dashboard.service.ts`, all numbering components, admin pages, migration pages, workflow components, login page #### ๐Ÿ”‘ **Fix Index-as-Key Anti-pattern** - **layout/sidebar.tsx**: Replaced `key={index}` with `key={item.href}` (desktop + mobile nav) - **admin/page.tsx**: Replaced `key={index}` with `key={stat.title}` and `key={link.href}` #### ๐Ÿ“ฆ **Component Consolidation** - **correspondences/form.tsx**: Replaced duplicate `FileUpload` import with canonical `FileUploadZone` - **custom/file-upload-zone.tsx**: Removed unnecessary `as any` cast in File constructor #### ๐Ÿ“Š **Type System Improvements** - **types/rfa.ts**: Added `items?: RFAItem[]` to `CreateRFADto` - **types/dto/rfa/rfa.dto.ts**: Added `items?: RFAItem[]` to `CreateRfaDto` (DTO version) - **Build**: โœ… `pnpm run build` passes with zero errors ### Build Fixes & Dependency Updates (2026-03-19) #### ๐Ÿ”ง **Build Issues Fixed** **Frontend Build**: - **Fixed Tailwind CSS v4.2.2 PostCSS compatibility** โ†’ Downgraded to v3.4.3 - **Fixed Zod + React Hook Form compatibility** โ†’ @hookform/resolvers@3.9.0 - **Fixed ambiguous routes** โ†’ Removed conflicting `[id]` routes - **Fixed TypeScript errors** โ†’ Added proper type casting in template-editor.tsx - **Result**: โœ… Zero warnings, 57 routes generated **Backend Build**: - **Migrated cache-manager-redis-yet โ†’ cache-manager-redis-store@3.0.1** - **Removed deprecated @types packages** โ†’ @types/cache-manager, @types/ioredis, @types/uuid - **Updated import statements** โ†’ Redis store import path changed - **Result**: โœ… Zero warnings, all dependencies compatible #### ๐Ÿ“ฆ **Package Updates** ```bash # Frontend tailwindcss: 4.2.2 โ†’ 3.4.3 @hookform/resolvers: 5.2.2 โ†’ 3.9.0 # Backend cache-manager-redis-yet: 5.1.5 โ†’ cache-manager-redis-store: 3.0.1 Removed: @types/cache-manager@5.0.0, @types/ioredis@5.0.0, @types/uuid@11.0.0 ``` #### ๐Ÿ“Š **Build Performance** - **Frontend**: 19.4s (57 routes, zero warnings) - **Backend**: ~30s (18 modules, zero warnings) - **Status**: โœ… Production Ready #### ๐Ÿ“ **Documentation Updated** - Updated AGENTS.md, .windsurfrules, CLAUDE.md, GEMINI.md - Created build-status-2026-03-19.md - Updated tech stack specifications ### Backend Security & Dependency Updates (2026-03-19) #### ๐Ÿ›ก๏ธ Security Vulnerabilities Fixed - **All 52 vulnerabilities resolved** (27 high + 20 moderate + 5 low severity) - **Security overrides applied**: 30 package overrides via `pnpm audit --fix` - **Current status**: "No known vulnerabilities found" - **Critical patches applied**: - Webpack SSRF bypass (via @nestjs/cli) - qs DoS vulnerability (via @compodoc/compodoc) - Multiple package security updates (axios, ajv, multer, etc.) #### ๐Ÿ“ฆ Backend Dependency Updates **Major Version Upgrades**: - `@elastic/elasticsearch`: 8.19.1 โ†’ 9.3.4 (Major version jump) - `nodemailer`: 7.0.11 โ†’ 8.0.3 (Major version jump) - `uuid`: 11.1.0 โ†’ 13.0.0 (Major version jump) - `@types/node`: 22.19.1 โ†’ 25.5.0 (Major version jump) **Security & Compatibility Updates**: - `eslint`: 9.39.1 โ†’ 9.39.1 (kept 9.x for typescript-eslint compatibility) - `typescript-eslint`: 8.48.0 โ†’ 8.57.1 (Latest compatible version) - `@types/uuid`: 10.0.0 โ†’ 11.0.0 (Deprecated package updated) - `ajv`: 8.17.1 โ†’ 8.18.0 - `axios`: 1.13.2 โ†’ 1.13.6 - `multer`: 2.0.2 โ†’ 2.1.1 #### ๐Ÿ”ง Build & Test Configuration - **Jest Configuration**: Added `transformIgnorePatterns` for UUID v13 ES modules compatibility - **Build Verification**: Backend builds successfully after updates - **Test Compatibility**: Sample tests pass (app.controller.spec.ts) - **ESLint Compatibility**: Maintained 9.x for ecosystem compatibility #### ๐Ÿ“‹ Package Management - **pnpm audit**: Clean slate - 0 vulnerabilities - **Dependency Resolution**: All peer dependency conflicts resolved - **Deprecated Packages**: All stub type warnings acknowledged and documented ### Dependency Updates (2026-03-19) #### Frontend Dependencies ๐Ÿ“ฆ - **Security Updates**: - Next.js: 16.0.7 โ†’ 16.2.0 (fixes security vulnerability) - React: 19.0.0 โ†’ 19.2.4 - React DOM: 19.0.0 โ†’ 19.2.4 - **ESLint Migration**: - ESLint: 8.57.1 โ†’ 9.39.1 (resolves deprecated warning) - eslint-config-next: 14.2.33 โ†’ 16.2.0 - Created new `eslint.config.mjs` for ESLint 9 compatibility - Updated lint script to use ESLint directly - **Package Cleanup**: - Removed deprecated `@types/uuid@11.0.0` (using built-in types from uuid@13.0.0) - Fixed TypeScript ESLint disable comments in template files - **Other Updates** (25+ packages): - axios: 1.13.2 โ†’ 1.13.6 - lucide-react: 0.555.0 โ†’ 0.577.0 - react-day-picker: 9.12.0 โ†’ 9.14.0 - react-hook-form: 7.66.1 โ†’ 7.71.2 - react-dropzone: 14.3.8 โ†’ 15.0.0 - zustand: 5.0.8 โ†’ 5.0.12 - tailwind-merge: 3.4.0 โ†’ 3.5.0 - zod: 4.1.13 โ†’ 4.3.6 - vitest: 4.0.15 โ†’ 4.1.0 - @types/node: 20.19.25 โ†’ 25.5.0 - tailwindcss: 3.4.18 โ†’ 4.2.2 - jsdom: 27.3.0 โ†’ 29.0.0 #### Documentation Updates ๐Ÿ“š - **CHANGELOG.md**: Added comprehensive dependency update section - **README.md**: Updated tech stack versions - **AGENTS.md**: Updated frontend stack versions - **CONTRIBUTING.md**: No changes required (already up-to-date) #### Quality Improvements โœ… - All deprecated package warnings resolved - ESLint 9 configuration working correctly - No peer dependency conflicts - All tests passing (vitest configuration stable) ### In Progress - UAT (User Acceptance Testing) โ€” เธ•เธฒเธก `01-05-acceptance-criteria.md` - KPI Baseline Collection (As-Is Metrics เธเนˆเธญเธ™ Go-Live) - Legacy Data Migration โ€” Tier 1 (2,000 docs Critical) - Final Security Audit โ€” เธ•เธฒเธก `04-06-security-operations.md` - Go-Live: Blue-Green Deploy เธšเธ™ QNAP Container Station ### NestJS 11 + Next.js 16 Migration (2026-03-16) #### Backend ๐Ÿ”ง - **NestJS 11 Upgrade**: `@nestjs/*` v11, Express v5, removed `@nestjs/mapped-types` - **RequestWithUser Interface**: Shared typed interface replacing `req: any` across 6 controllers (`auth`, `session`, `file-storage`, `workflow-engine`, `correspondence`, `jwt-refresh`) - **MasterModule DI Fix**: Imported `UserModule` so `RbacGuard` can resolve `UserService` - **TypeORM Fix**: Explicit typing for `DocumentNumberFormat` save/create overload resolution - **Swagger**: Updated API version to 1.8.1 ### Frontend ๐ŸŽจ - **Next.js 16 Upgrade**: Next.js 16.0.7 โ†’ 16.2.0, React 19 โ†’ 19.2.4 (Security Fix) - **ESLint 9 Migration**: ESLint 8.57.1 โ†’ 9.39.1, removed deprecated warnings - **Dependency Updates**: Updated 25+ packages to latest stable versions - **Deprecated Package Cleanup**: Removed `@types/uuid@11.0.0` (using built-in types) - **proxy.ts Rename**: `middleware.ts` โ†’ `proxy.ts` (Next.js 16 deprecated `middleware` convention) - **ADR-019 UUID Fixes โ€” Drawing Admin Pages (5 pages)**: - `contract/volumes`, `contract/categories`, `contract/sub-categories` - `shop/main-categories`, `shop/sub-categories` - Changed `useState` โ†’ `useState`, removed `parseInt(uuid)` - **ADR-019 UUID Fixes โ€” Contract Page**: - Fixed edit form showing "New Contract" (`contract.uuid` โ†’ `contract.id` after `@Expose`) - Fixed blank Project dropdown (was using contract's UUID instead of project's UUID) - Fixed delete passing `undefined` uuid - Updated `Contract` interface to match serialized API response - **ADR-019 UUID Fixes โ€” Disciplines & RFA Types**: - `useContracts(projectId=1)` โ†’ optional param, fetches all contracts when unspecified - `useDisciplines(contractId?: number)` โ†’ `number | string` - **ADR-019 UUID Fixes โ€” Tags Page**: - Fixed Radix Select crash on empty `value=""` โ†’ `"__none__"` sentinel - Fixed Project Scope dropdown showing UUIDs (snake_case โ†’ camelCase field names) - **DTO Updates**: `CreateContractDto`, `SearchContractDto`, `CreateShopMainCategoryDto`, etc. โ€” `projectId: number` โ†’ `number | string` - **Service Updates**: `drawing-master-data.service.ts`, `master-data.service.ts` โ€” accept `string | number` for project/contract IDs #### Documentation ๐Ÿ“š - **ADR-005**: Updated Backend Stack table (NestJS 11, Express v5) - **Engineering Guidelines** (`05-01`): Added NestJS 11 specific patterns section - **README.md**: Tech stack versions, status date, ADR-019 in roadmap - **AGENTS.md**: Tech stack versions updated --- ## 1.8.1 Patch (2026-03-11) ### Summary **Product Owner Documentation Complete** โ€” เธ›เธดเธ” 10/10 Documentation Gaps เธชเธณเธซเธฃเธฑเธš UAT Readiness เธฃเธฐเธšเธšเธกเธตเน€เธญเธเธชเธฒเธฃเธ„เธฃเธšเธ–เน‰เธงเธ™เธชเธณเธซเธฃเธฑเธš Stakeholder Sign-off เนเธฅเธฐ Go-Live Process ### Documentation ๐Ÿ“š โ€” 10/10 Gaps Closed #### Gap 1: Product Vision Statement โœ… `specs/00-Overview/00-03-product-vision.md` - Elevator Pitch, Problem Statement, Geoffrey Moore Vision Format - Strategic Pillars: Speed / Security / Visibility - Phase Roadmap (Now โ†’ 24 เน€เธ”เธทเธญเธ™), Guardrails, Success Metrics #### Gap 2: User Stories โœ… `specs/01-Requirements/01-04-user-stories.md` - 27 User Stories เธ„เธฃเธญเธšเธ„เธฅเธธเธก 8 Epics - MoSCoW Prioritization per Story - Acceptance Criteria + Definition of Done #### Gap 3: Acceptance Criteria (UAT) โœ… `specs/01-Requirements/01-05-acceptance-criteria.md` - 35 Acceptance Criteria (All Modules) - UAT Plan: 4 Phases, Sign-off Process - Go-Live Criteria Matrix #### Gap 4: UI/UX Wireframes โœ… `specs/01-Requirements/01-07-ui-wireframes.md` - Screen Inventory: 26 Screens เธžเธฃเน‰เธญเธก Role + Priority - Navigation Map / Site Map เธ„เธฃเธšเธ—เธธเธ Route - ASCII Wireframes: Login, Dashboard, Correspondence, RFA, Circulation, Admin - Design System Tokens + Interaction Patterns #### Gap 5: Stakeholder Sign-off & Risk โœ… `specs/00-Overview/00-04-stakeholder-signoff-and-risk.md` - Sign-off Process 4-Step + Digital Sign Matrix - Risk Register: 15 Risks (Impact ร— Probability Matrix) - Change Control Policy + Emergency Change Process #### Gap 6: KPI Baseline Data โœ… `specs/00-Overview/00-05-kpi-baseline.md` - 14 KPIs เธžเธฃเน‰เธญเธก Baseline Collection Form - SQL Measurement Queries + Grafana Dashboard Specs - User Satisfaction Survey Template #### Gap 7: Migration Business Scope โœ… `specs/03-Data-and-Storage/03-06-migration-business-scope.md` - Data Scope: IN/OUT SCOPE (เธ›เธต 2564 โ†’ Go-Live) - Migration Tiers: Tier 1 (2K Critical) / Tier 2 (10K) / Tier 3 (8K Archive) - Excel Metadata Mapping (11 Columns โ†’ Field เนƒเธซเธกเนˆ) - Organization Code Lookup Table - Timeline: T-6 เธชเธฑเธ›เธ”เธฒเธซเนŒ โ†’ Go-Live โ†’ T+30 - Go/No-Go Gates 3 เธ”เนˆเธฒเธ™ - Data Security: AI Isolation (ADR-018) + Token 7 เธงเธฑเธ™ + IP Whitelist #### Gap 8: Release Management Policy โœ… `specs/04-Infrastructure-OPS/04-08-release-management-policy.md` - SemVer Strategy + Git Flow (main/release/develop/hotfix) - 5 Release Gates: Code Complete โ†’ QA โ†’ Staging โ†’ Approval โ†’ Production - Quality Thresholds: TS 0 errors, โ‰ฅ80% Test Coverage, 0 Critical Vuln - Hotfix Process: P0 < 4h / P1 < 24h + Decision Tree - Rollback Policy: SLA < 30 เธงเธด (Blue-Green) + Auto-trigger Rules - CI/CD Pipeline: 5 Stages (Quality โ†’ Security โ†’ Build โ†’ Integration โ†’ Release) - Release Checklist + Security Pre-release Requirements #### Gap 9: Training Plan โœ… `specs/00-Overview/00-06-training-plan.md` - Curriculum เนเธšเนˆเธ‡เธ•เธฒเธก Role (4 Roles) - 4-Phase Training Timeline - Hands-on Lab + Assessment Criteria #### Gap 10: Edge Cases & Business Rules โœ… `specs/01-Requirements/01-06-edge-cases-and-rules.md` - 37 Edge Cases เธ„เธฃเธญเธšเธ„เธฅเธธเธกเธ—เธธเธ Module - Business Logic Guards + Error Handling Matrix ### Architecture Decision Records ๐Ÿ›๏ธ - **ADR-018** (Patch 1.8.1): AI Boundary โ€” Ollama Isolation Policy - Ollama เน„เธกเนˆเธกเธต Direct DB/Storage Access - AI Output เธ•เน‰เธญเธ‡เธœเนˆเธฒเธ™ Backend Validation เธเนˆเธญเธ™ Write - Migration Bot Token: IP Whitelist + 7-day Expiry ### READMEs Updated ๐Ÿ“„ - `README.md`: Status badge v1.8.1, UAT Ready, 10/10 Gaps table, fixed schema commands, updated Roadmap - `CONTRIBUTING.md`: Spec tree updated (new files), schema filenames corrected, category table updated - `specs/00-Overview/README.md`: Quick Links table เน€เธžเธดเนˆเธก Gap 4/7/8 links - `specs/01-Requirements/README.md`: Gap documents registered - `specs/03-Data-and-Storage/README.md`: Migration Scope registered - `specs/04-Infrastructure-OPS/README.md`: Release Policy registered ## 1.8.0 (2026-02-24) ### Summary **Documentation Realignment & Type Safety** - Comprehensive overhaul of the specifications structure and frontend codebase to enforce strict typing and consistency. ### Codebase Changes ๐Ÿ’ป - **Frontend Type Safety**: Removed all `any` types from Frontend DTOs and Hooks. Implemented explicit types (`AuditLog[]`, `Record`) avoiding implicit fallbacks. - **Frontend Refactoring**: Refactored data fetching and mutations utilizing `TanStack Query` hooks aligned with real API endpoints. - **Admin Pages Fixes**: Addressed crashes on Reference Data/Categories pages by introducing robust error handling and proper generic typing on DataTables. ### Documentation ๐Ÿ“š - **Specification Restructuring**: Restructured the entire `specs/` directory into 7 canonical layers (`00-Overview`, `01-Requirements`, `02-Architecture`, `03-Data-and-Storage`, `04-Infrastructure-OPS`, `05-Engineering-Guidelines`, `06-Decision-Records`). - **Guidelines Synchronization**: Updated Engineering Guidelines (`05-1` to `05-4`) to reflect the latest state management (Zustand, React Hook Form) and testing strategies. - **ADR Alignment**: Audited Architecture Decision Records (ADR 1 to 16) against actual implementation (e.g., LocalStorage JWT vs HTTP-Only cookies, bcrypt salt rounds). - **Root Docs Update**: Fully updated `README.md` and `CONTRIBUTING.md` to reflect the current v1.8.0 folder structure and rules. - **Cleanups**: Consolidated standalone infrastructure specs (formerly `08-infrastructure`) into `04-Infrastructure-OPS` and cleaned up legacy scripts and blank diagrams from the repository root. ## 1.7.0 (2025-12-18) ### Summary **Schema Stabilization & Document Numbering Overhaul** - Significant schema updates to support advanced document numbering (reservations, varying reset scopes) and a unified workflow engine. ### Database Schema Changes ๐Ÿ’พ #### Document Numbering System (V2) ๐Ÿ”ข - **`document_number_counters`**: - **Breaking Change**: Primary Key changed to 8-column Composite Key (`project_id`, `originator_id`, `recipient_id`, `type_id`, `sub_type_id`, `rfa_type_id`, `discipline_id`, `reset_scope`). - **New Feature**: Added `reset_scope` column to support flexible resetting (YEAR, MONTH, PROJECT, NONE). - **New Feature**: Added `version` column for Optimistic Locking. - **`document_number_reservations`** (NEW): - Implemented Two-Phase Commit pattern (Reserve -> Confirm) for document numbers. - Prevents race conditions and gaps in numbering. - **`document_number_errors`** (NEW): - Helper table for tracking numbering failures and deadlocks. - **`document_number_audit`**: - Enhanced with reservation tokens and performance metrics. #### Unified Workflow Engine ๐Ÿ”„ - **`workflow_definitions`**: - Updated structure to support compiled DSL and versioning. - Added `dsl` (JSON) and `compiled` (JSON) columns. - **`workflow_instances`**: - Changed ID to UUID. - Added `entity_type` and `entity_id` for polymorphic polymorphism. - **`workflow_histories`**: - Updated to link with UUID instances. #### System & Audit ๐Ÿ›ก๏ธ - **`audit_logs`**: - Updated schema for better partitioning support (`created_at` in PK). - Standardized JSON details column. - **`notifications`**: - Updated schema to support polymorphic entity linking. #### Master Data - **`disciplines`**: - Added relation to `correspondences` and `rfas`. ### Documentation ๐Ÿ“š - **Data Dictionary**: Updated to v1.7.0 with full index summaries and business rules. - **Schema**: Released `lcbp3-v1.7.0-schema.sql` and `lcbp3-v1.7.0-seed.sql`. ## 1.6.0 (2025-12-13) ### Summary **Schema Refactoring Release** - Major restructuring of correspondence and RFA tables for improved data consistency. ### Database Schema Changes ๐Ÿ’พ #### Breaking Changes โš ๏ธ - **`correspondence_recipients`**: FK changed from `correspondence_revisions(correspondence_id)` โ†’ `correspondences(id)` - **`rfa_items`**: Column renamed `rfarev_correspondence_id` โ†’ `rfa_revision_id` #### Schema Refactoring - **`correspondences`**: Reordered columns, `discipline_id` now inline (no ALTER TABLE) - **`correspondence_revisions`**: - Renamed: `title` โ†’ `subject` - Added: `body TEXT`, `remarks TEXT`, `schema_version INT` - Added Virtual Columns: `v_ref_project_id`, `v_doc_subtype` - **`rfas`**: - Changed to Shared PK pattern (no AUTO_INCREMENT) - PK now FK to `correspondences(id)` - **`rfa_revisions`**: - Removed: `correspondence_id` (uses rfas.id instead) - Renamed: `title` โ†’ `subject` - Added: `body TEXT`, `remarks TEXT`, `due_date DATETIME`, `schema_version INT` - Added Virtual Column: `v_ref_drawing_count` ### Documentation ๐Ÿ“š - Updated Data Dictionary to v1.6.0 - Updated schema SQL files (`lcbp3-v1.6.0-schema.sql`, seed files) ## 1.5.1 (2025-12-10) ### Summary **Major Milestone: System Feature Complete (~95%)** - Ready for UAT and production deployment. All core modules implemented and operational. Backend and frontend fully integrated with comprehensive admin tools. ### Backend Completed โœ… #### Core Infrastructure - โœ… All 18 core modules implemented and tested - โœ… JWT Authentication with Refresh Token mechanism - โœ… RBAC 4-Level (Global, Organization, Project, Contract) using CASL - โœ… Document Numbering with Redis Redlock + Optimistic Locking - โœ… Workflow Engine (DSL-based Hybrid Engine with legacy support) - โœ… Two-Phase File Storage with ClamAV Virus Scanning - โœ… Global Audit Logging with Interceptor - โœ… Health Monitoring & Metrics endpoints #### Business Modules - โœ… **Correspondence Module** - Master-Revision pattern, Workflow integration, References - โœ… **RFA Module** - Full CRUD, Item management, Revision handling, Approval workflow - โœ… **Drawing Module** - Separated into Shop Drawing & Contract Drawing - โœ… **Transmittal Module** - Document transmittal tracking - โœ… **Circulation Module** - Circulation sheet management - โœ… **Elasticsearch Integration** - Direct indexing, Full-text search (95% complete) #### Supporting Services - โœ… **Notification System** - Email and LINE notification integration - โœ… **Master Data Management** - Consolidated service for Organizations, Projects, Disciplines, Types - โœ… **User Management** - CRUD, Assignments, Preferences, Soft Delete - โœ… **Dashboard Service** - Statistics and reporting APIs - โœ… **JSON Schema Validation** - Dynamic schema validation for documents ### Frontend Completed โœ… #### Application Structure - โœ… All 15 frontend tasks (FE-001 to FE-015) completed - โœ… Next.js 14 App Router with TypeScript - โœ… Complete UI implementation (17 component groups, 22 Shadcn/UI components) - โœ… TanStack Query for server state management - โœ… Zustand for client state management - โœ… React Hook Form + Zod for form validation - โœ… Responsive layout (Desktop & Mobile) #### End-User Modules - โœ… **Authentication UI** - Login, Token Management, Session Sync - โœ… **RBAC UI** - `` component for permission-based rendering - โœ… **Correspondence UI** - List, Create, Detail views with file uploads - โœ… **RFA UI** - List, Create, Item management - โœ… **Drawing UI** - Contract & Shop drawing lists, Upload forms - โœ… **Search UI** - Global search bar, Advanced filtering with Elasticsearch - โœ… **Dashboard** - Real-time KPI cards, Activity feed, Pending tasks - โœ… **Circulation UI** - Circulation sheet management with DataTable - โœ… **Transmittal UI** - Transmittal tracking and management #### Admin Panel (10 Routes) - โœ… **Workflow Configuration** - DSL Editor, Visual Builder, Workflow Definition management - โœ… **Document Numbering Config** - Template Editor, Token Tester, Sequence Viewer - โœ… **User Management** - CRUD, Role assignments, Preferences - โœ… **Organization Management** - Organization CRUD and hierarchy - โœ… **Project Management** - Project and contract administration - โœ… **Reference Data Management** - CRUD for Disciplines, Types, Categories (6 modules) - โœ… **Security Administration** - RBAC Matrix, Roles, Active Sessions (2 modules) - โœ… **Audit Logs** - Comprehensive audit log viewer - โœ… **System Logs** - System log monitoring - โœ… **Settings** - System configuration ### Database ๐Ÿ’พ - โœ… Schema v1.5.1 with standardized audit columns (`created_at`, `updated_at`, `deleted_at`) - โœ… Complete seed data for all master tables - โœ… Migration scripts and patches (`patch-audit-columns.sql`) - โœ… Data Dictionary v1.5.1 documentation ### Documentation ๐Ÿ“š - โœ… Complete specs/ reorganization to v1.5.1 - โœ… 21 requirements documents in `specs/01-requirements/` - โœ… 17 ADRs (Architecture Decision Records) in `specs/05-decisions/` - โœ… Implementation guides for Backend & Frontend - โœ… Operations guides for critical features (Document Numbering) - โœ… Comprehensive progress reports updated - โœ… Task archiving to `specs/09-history/` (27 completed tasks) ### Bug Fixes ๐Ÿ› - ๐Ÿ› Fixed role selection bug in User Edit form (2025-12-09) - ๐Ÿ› Fixed workflow permissions - 403 error on workflow action endpoints - ๐Ÿ› Fixed TypeORM relation errors in RFA and Drawing services - ๐Ÿ› Fixed token refresh infinite loop in authentication - ๐Ÿ› Fixed database schema alignment issues (audit columns) - ๐Ÿ› Fixed "drawings.map is not a function" by handling paginated responses - ๐Ÿ› Fixed invalid refresh token error loop ### Changed ๐Ÿ“ - ๐Ÿ“ Updated progress reports to reflect ~95% backend, 100% frontend completion - ๐Ÿ“ Aligned all TypeORM entities with schema v1.5.1 - ๐Ÿ“ Enhanced data dictionary with business rules - ๐Ÿ“ Archived 27 completed task files to `specs/09-history/` ## 1.5.0 (2025-11-30) ### Summary Initial spec-kit structure establishment and documentation organization. ### Changed - Changed the version to 1.5.0 - Modified to Spec-kit