Changelog
v1.4.1Track all changes, improvements, and new features in the Bill of Entry system.
Key Highlights:
- 🚛 Container Assignment System: Full drag & drop interface with bulk operations
- 🔧 CRITICAL FIX: Modal scrolling for containers and BOLs columns
- 📋 Advanced Bill of Lading Management with inline editing system
- 📊 Volume Auto-Calculation System with legacy business rules
- 🔄 100% DegroupFinalLevel.pas workflow compatibility maintained
- 🎨 Professional ScrollArea integration for reliable cross-browser scrolling
- ⚡ Real-time assignment tracking and visual feedback
- 🏗️ Enhanced LegacyMapper with container assignment logic
- 📁 Comprehensive documentation reorganization and cleanup
Key Highlights:
- 🤖 Auto-creation system for suppliers, importers, warehouses, and points of entry
- ⚡ XML import enhanced with UN LOCODE port auto-creation
- 🔧 Fixed port seeding issues with proper country field mapping
- 🛡️ Safe operations with skipIfExists and graceful failure handling
- 📋 Evidence-based merge conflict resolution with code preservation
- 🔄 Legacy compliance maintained throughout auto-creation process
- 🎯 Quality of life improvements reducing manual reference data entry
- 📊 Enhanced stocklist page and HS code request management
Detailed Changes:
Comprehensive Auto-Creation System
featureCreated AutoCreationHelper.ts with safe auto-creation functions for approved reference data types (suppliers, importers, warehouses, points of entry). Features skipIfExists logic, silentFail error handling, and user isolation with proper transaction patterns.
BOE Excel Import Auto-Creation Integration
featureIntegrated auto-creation into Excel import workflow to automatically create missing reference data before BOE creation. Reduces manual setup and prevents import failures due to missing relationships.
XML Import Port Auto-Creation
featureEnhanced manifest.ts with UN LOCODE port auto-creation during XML processing. Automatically creates departure and arrival ports to prevent XML import failures due to missing port references.
Port Seeding Country Lookup Fix
fixFixed seed-ports.ts country lookup from iso2_code to code field, resolving seeding failures. Ensures proper country relationships for port data during system initialization.
Evidence-Based Merge Conflict Resolution
fixResolved merge conflicts using evidence-based approach following LegacyMapper patterns. Preserved both implementations with //todo markers, no code removal, and maintained legacy compliance patterns.
Stocklist Page Implementation
featureCreated stocklist page for inventory management functionality with consistent UI patterns and legacy-compliant data handling for improved inventory tracking.
HS Code Request Management Enhancement
enhancementEnhanced HS code requests table with improved filtering and display capabilities, maintaining consistency with existing UI patterns for better user experience.
Safe Auto-Creation with Error Handling
enhancementImplemented comprehensive error handling ensuring auto-creation operations don't disrupt core business processes. Features silent failure modes and graceful degradation to maintain system stability.
Country Router and Tax Calculator Updates
fixResolved country router conflicts and updated TaxCalculator.ts with preserved legacy compliance patterns. Applied evidence-based conflict resolution maintaining dual implementations.
Key Highlights:
- 📊 Successfully migrated 498 suppliers from legacy TXEEXPORTR system
- 🏢 Successfully migrated 24 importers from legacy TXEIMPORTR system
- 🔍 Comprehensive 8-level deep legacy database analysis with 3 detailed reports
- 🗃️ Critical data gaps identified and resolved for tRPC operational functionality
- 🛠️ Production-ready migration scripts created for future manifest data
- ⚖️ Fixed duplicate changelog routes blocking build compilation
- ✅ Achieved clean production build with 37 static pages generated
- 🎯 System now appears professional with real operational data from 7+ years
Detailed Changes:
Critical Trading Partners Data Migration
featureSuccessfully executed Priority 1 migration of 498 suppliers from legacy TXEEXPORTR and 24 importers from legacy TXEIMPORTR tables. Resolved critical data gaps where importer/exporter dropdowns were nearly empty (23 vs 500+ expected, 9 vs 300+ expected), making system appear non-functional.
Comprehensive Legacy Database Analysis
featureCreated three comprehensive analysis documents: MIGRATION_VERIFICATION_ANALYSIS.md (initial 95% assessment), DEEP_DIVE_MIGRATION_ANALYSIS.md (47-section technical analysis), and MIGRATION_DATA_GAPS_ANALYSIS.md (critical data gaps discovery). Identified schema vs operational data discrepancy.
Production-Ready Migration Scripts
featureCreated migrate-trading-partners.ts (executed successfully) and migrate-manifest-operational-data.ts (ready for future use). Scripts include proper error handling, duplicate detection, ESM compatibility, and correct Prisma client integration.
Migration Script Technical Fixes
fixFixed Prisma client import paths ('db' vs '@prisma/client'), resolved ESM module compatibility issues, corrected database field mappings to match actual schema structure (name vs company_name, telephone vs telephone_no), and implemented proper user ID handling.
Build System Route Conflict Resolution
fixFixed duplicate changelog routes error preventing build compilation by removing conflicting /dashboard/changelog/page.tsx while preserving comprehensive changelog progress in main /changelog/page.tsx.
System Operational Readiness Achievement
enhancementTransformed system from appearing empty/non-functional to professional operational status with real historical data. BOE forms now reference actual trading partners, dropdowns populated with 500+ companies, establishing foundation for incremental manifest data addition.
Data Classification & Impact Analysis
featureClassified data as tenant-specific (Mahe Shipping), system-wide, and hybrid categories. Documented business impact: empty search results → rich historical data, limited dropdowns → complete options, poor UX → professional appearance.
Key Highlights:
- ✅ Zero TypeScript compilation errors achieved
- 🏗️ Build system optimization and webpack configuration fixes
- 🔍 Evidence-based legacy field mapping verification via LegacyMapper.ts
- 📋 CIC permit system field restoration and corrections
- 🚢 Manifest system legacy field mapping alignment
- ⚡ Environmental levy system database access fixes
- 🔧 Production-ready build with clean deployment status
Detailed Changes:
Complete TypeScript Compilation Error Resolution
fixSystematically resolved ~95+ TypeScript compilation errors through evidence-based field mapping corrections cross-referenced against LegacyMapper.ts documentation and legacy system analysis.
CIC Permit System Legacy Field Restoration
fixRestored critical custom_number field mapping to ICICUNUM legacy field and corrected snake_case database field mappings (line_status, export_line_items) with proper data structure for HS codes and pricing.
Manifest System Legacy Corrections
fixCorrected vessel nationality field mapping from transporter_nationality_code to vessel_nationality per LegacyMapper.ts verification. Fixed package fields, transport mode, and mass field mappings.
Environmental Levy System Database Access
fixReplaced invalid ctx.procedures with direct database queries aligned with LEVRULES table access patterns for proper environmental levy calculations.
Build System Webpack Optimization
fixRemoved problematic optimizePackageImports configuration causing webpack caching conflicts. Fixed PrismaClientKnownRequestError import paths from incorrect 'db/runtime/library' to '@prisma/client/runtime/library'.
Legacy Documentation & Field Mapping Verification
enhancementAll field mapping changes cross-referenced against LegacyMapper.ts documentation ensuring accuracy and preventing future migration issues. Comprehensive legacy system integration verification.
Production Build Stability
fixAchieved clean TypeScript compilation with zero errors, successful generation of all 34 static pages, and optimized bundle sizes ready for production deployment.
Key Highlights:
- ✅ 100% XML export validation success - matches legacy system format perfectly
- 📝 Made description field optional in BOE line items for improved UX
- 📦 Enhanced package type dropdown to show 'Description (Code)' format
- 🔧 Fixed HS Code validation to support manual entry when DB lookup fails
- 🎯 Resolved all critical XML export issues with missing SCPO point of entry
- ⚡ Automated XML testing framework for consistent validation
- 🧪 End-to-end manual testing confirmed full functionality
Detailed Changes:
XML Export Data Completeness
fixFixed critical XML export issue where generated XML had empty fields (voyage_number, customs_office_code, etc.) compared to legacy samples. Added missing SCPO point of entry and created proper test BOE data for validation.
Optional Description Field
enhancementMade description field optional in BOE line items by removing required validation from tempBillItemSchema. Users can now submit items without forced description entry.
Improved Package Type Display
enhancementEnhanced package type dropdown to show format 'Description (Code)' instead of 'Description Code'. Users can now easily see that code '08' corresponds to 'Units/Pcs (08)'.
HS Code Manual Entry Support
fixConfirmed backend properly supports manual HS code entry (returns hsCodeFound: false but allows operation). Resolved any frontend validation issues that were blocking manual HS code entry.
Automated XML Testing Framework
featureCreated comprehensive XML testing script (fix-xml-export-data.ts) that automatically validates XML exports against legacy samples with field-by-field comparison for quality assurance.
End-to-End Manual Validation
testingConducted complete manual testing using ALAIN_019.xml legacy sample data. User successfully generated XML matching legacy format, confirming full workflow functionality.
Key Highlights:
- 🗄️ Complete migration of 15,054 international ports from SPACE95MANIFEST.GDB
- 🌍 Migration of 258 countries with proper code standardization
- 📋 BOE operational data migration with field mapping corrections
- 🔧 Schema relationship fixes for NextAuth v5 and Prisma compatibility
- 📦 Package.json migration commands for streamlined deployment
- 📚 Comprehensive LegacyMapper documentation system
- 🔍 Missing field analysis and tracking for future migration phases
- ⚡ Automated migration scripts with error handling and validation
Detailed Changes:
Global Ports Migration System
featureSuccessfully migrated 15,054 international ports from SPACE95MANIFEST.GDB with proper country relationships and port classification. Includes comprehensive parsing of MPORTS table with legacy ID preservation and code standardization.
BOE Operational Data Migration
featureComplete migration system for Bills of Entry from TXEBOE and TXEBOELINS tables. Successfully parsed 651 BOE headers and 43,785 line items with proper field mapping (cif_value, line_no, unit_id) and foreign key relationship handling.
NextAuth v5 Compatibility Resolution
fixFixed critical NextAuth compatibility issues caused by downgrade from v5.0.0-beta.25 to v4.24.11. Restored proper middleware functionality and resolved 'Invalid value used as weak map key' runtime errors.
Database Field Naming Corrections
fixSystematic fix of camelCase vs snake_case field naming inconsistencies across CIC export permits, reference data, and user models. Corrected deletedAt → deleted_at, permitYear → permit_year, createdBy → created_by throughout the system.
Migration Command Infrastructure
featureAdded comprehensive migration commands to package.json: db:migrate-boe, db:migrate-full, db:migrate-all for different migration scenarios. Includes proper script organization and execution flow.
Legacy Field Analysis & Documentation
enhancementCreated missing-legacy-fields-2025-01-04.md with comprehensive analysis of TXEBOE and TXEBOELINS field mappings. Documented successfully mapped fields and identified areas requiring future migration phases.
Environmental Levy Rules Migration
featureMigrated environmental levy rules from BOESYS LEVRULES table with HS code mapping, unit costs, and quantity application rules. Supports plastic bottle levies (0.7 SCR) and container-based calculations.
Tax Concession Codes Migration
featureComplete migration of TAXCONSC table with concession codes, descriptions, GST percentages, and tax percentages. Includes proper null handling and percentage validation.
Enhanced LegacyMapper Documentation
enhancementUpdated LegacyMapper.ts with comprehensive migration documentation including command usage, data analysis results, and field mapping strategies. Serves as central reference for legacy system integration.
Schema Relationship Handling
enhancementFixed Prisma schema relationship issues by correcting foreign key field usage (user_id vs user relation), proper connection syntax, and field name alignment with database schema.
Migration Validation System
featureImplemented comprehensive migration result validation with PostgreSQL queries for record counts, data integrity checks, and successful migration confirmation. Includes psql-based verification workflows.
Package Types Code Field Alignment
enhancementFixed package types frontend and API consistency by aligning code field usage (package_code) and resolving React key prop issues in tax concession codes component.
Key Highlights:
- ⚙️ Configurable freight rate management system with multi-tenant support
- 🌱 Environmental levy rules system for HS-code specific charges
- 💰 Database-driven freight calculations replacing hardcoded values
- 📊 Admin dashboards for rate configuration and management
- 🗓️ Temporal validity system for scheduled rate changes
- 👥 Multi-tenant support with system-wide and organization-specific rates
- 📋 Complete audit trail with user attribution for all changes
- 🔄 Legacy system integration with comprehensive data migration
Detailed Changes:
Freight Rate Configuration System
featureNew freight_rate_config model and freightRateConfigRouter with full CRUD operations. Replaces hardcoded values (doFee: 250.00, cfsCharge2: 140.00, vatPercentage: 15.0) with database-configurable parameters. Supports multi-tenant rates and temporal validity.
Environmental Levy Rules Engine
featureComplete environmental_levy_rules system for HS-code specific levies from legacy LEVRULES table. Supports plastic bottles (0.7 SCR), beverages (0.25 SCR/liter), containers with quantity-based calculations and partial HS code matching.
Database-Driven Freight Calculator
enhancementUpdated manifest-freight-calculator.ts to use configurable rates via getDefaultManifestFreightParams() with database integration and fallback to hardcoded values for backwards compatibility.
Multi-Tenant Rate Management
featureBoth freight rates and environmental levies support tenant-specific configurations (tenant_id field) allowing different organizations to maintain custom rate structures while supporting system-wide defaults.
Temporal Validity System
featureAdded effective_from and effective_to fields enabling scheduled rate changes, historical rate tracking, and seamless rate transitions without system downtime.
Comprehensive Data Migration System
featureComplete legacy database analysis with 199,144 lines of structured data from BOESYS.gdb (60,085 lines, 44 tables) and SPACE95MANIFEST.GDB (139,059 lines, 18 tables) for comprehensive system migration.
Seed Data Configuration
featureCreated seed-freight-rates.ts with default Seychelles configurations including all 10 freight parameters (D/O fee, CFS rates, VAT, exchange rates) and environmental levy samples for immediate system usability.
Enhanced Tax Concession System
enhancementDocumented existing tax_concession_codes system with comprehensive tRPC router functionality. Fixed seed file field mapping (conc_code vs concession_code) for proper database integration.
Admin API Infrastructure
featureAdded freightRateConfig and environmentalLevyRules routers to main appRouter with role-based access control (adminProcedure for modifications, protectedProcedure for queries).
Role-Based Access Control Integration
securityAll new systems implement proper RBAC with admin-only procedures for rate modifications and protected procedures for queries, ensuring secure configuration management.
Key Highlights:
- ⚖️ Container weight now auto-updates total weight field when containers are added/modified
- 💱 Exchange rate immediately updates when currency is changed across all forms
- 🔄 Fixed shared component consistency in Excel import modals
- 🛠️ Improved form reactivity with proper shouldDirty and shouldTouch flags
- 🎯 Enhanced user experience with real-time field updates
Detailed Changes:
Container Weight Auto-Calculation
fixAdded refetch mechanism to automatically update total_weight field after container operations. Users no longer need to manually refresh to see calculated weights.
Exchange Rate Reactivity
fixFixed exchange rate field not updating when currency is changed. Added getAutoExchangeRate logic with form.setValue and proper reactivity flags.
Shared Component Consistency
fixFixed missing exchange rate auto-update logic in shared CommercialTab component used by Excel import modals. All forms now have consistent behavior.
TypeScript Compatibility
fixFixed Decimal type casting issues in bill data refetch operations and Prisma transaction type compatibility for container weight calculator.
Key Highlights:
- 🎨 Fixed dropdown width constraint with w-64 class
- 📏 Reduced height from 320px to 240px for better fit
- 🔄 Added proper scrolling behavior with overflow-auto
- 📌 Pinned footer to bottom with flex layout
- ✨ Improved overall user experience for HS code selection
Detailed Changes:
Dropdown Width Constraint
fixAdded w-64 class to constrain dropdown width instead of stretching full width, improving visual appearance and usability.
Optimized Container Height
enhancementReduced max height from 320px to 240px (max-h-60) to prevent overflow while maintaining scrollability.
Improved Scrolling Behavior
enhancementAdded overflow-auto to Card for proper scrolling behavior and better content management.
Fixed Footer Layout
enhancementRestructured layout with flex-col to pin footer at bottom and added flex-1 to ScrollArea for proper space distribution.
Key Highlights:
- 🛡️ Fixed dashboard role-based access control
- 🚫 Viewers can no longer access creation forms
- 📋 BOE users restricted from manifest sections
- 🧭 Role-based navigation implemented
- ✅ All RBAC tested with seeded accounts
Detailed Changes:
Dashboard RBAC Implementation
fixFixed dashboard role-based access control using ServerBOEOnly, ServerManifestOnly, ServerViewerPlus guards to properly restrict access based on user roles.
Navigation Access Control
fixBOE users can no longer see Manifest Management sections and viewer users cannot access creation buttons and forms.
Server-Side Role Guards
enhancementImplemented comprehensive server-side role guards throughout the application to prevent unauthorized access.
Users List Role Checking
fixUpdated users list to use server-side role checking instead of client-side for improved security.
TypeScript Compilation Fixes
fixResolved TypeScript compilation errors in auth config and components, fixed type-only imports.
Role-Based Navigation Component
featureAdded RoleBasedNavigation component for consistent role-based menu rendering across the application.
Centralized Role Checking
enhancementImplemented getServerRolePermissions helper for centralized role checking and permission management.
RBAC Testing Verification
featureSuccessfully tested with seeded accounts (System Owner, Admin, BOE user, Manifest user, Viewer) and verified Excel import functionality.
Key Highlights:
- 🏢 Multi-tenant architecture with complete data isolation
- 👑 System owner dashboard for platform management
- 🔐 Enhanced RBAC with tenant-scoped permissions
- ⚡ Legacy auto-calculation system integration
- 📄 BOE creation from manifest data
- 🚢 Shipping marks auto-population
- 🔒 Security-hardened system owner authentication
Detailed Changes:
Multi-Tenant Data Architecture
featureAdded user_id fields to all tenant-scoped models (bills_of_entry, importers, suppliers, manifests, warehouses) for complete data isolation between shipping companies.
System Owner Dashboard Implementation
featureNew platform-wide dashboard showing tenant statistics, license distribution, API usage across all tenants, and top active tenants with proper root user detection.
Tenant Isolation in TRPC Procedures
featureUpdated all TRPC procedures to enforce tenant boundaries with user_id filtering in queries and access control checks.
Homepage Navigation Enhancement
featureAdded 'What's New' badge linking to changelog and footer navigation for better user discovery of new features.
Comprehensive RBAC System
featureImplemented role-based access control with audit capabilities, permission middleware, and granular resource-action permissions.
Multi-Tenant Seed Data
featureCreated comprehensive seed data with system owner and Mahe Shipping tenant users, including proper role assignments and data relationships.
System Owner Security Enhancement
securityFixed system owner detection to use authenticated user data instead of insecure URL parameters. All system owner checks now based on database user profile.
System-Wide Data Access for System Owners
featureAdded getSystemWideAll procedures for Bills of Entry allowing system owners to view all tenant data with proper tenant identification columns.
System Owner Dashboard Refinement
enhancementEnhanced system owner dashboard to focus on platform management and user administration instead of data creation, with read-only oversight capabilities.
TypeScript Compilation Fixes
fixResolved compilation errors and refactored authentication middleware for better type safety and reliability.
Legacy Auto-Calculation System
featureComprehensive legacy-compatible calculation system for duties, taxes, and fees with accurate weight distribution and duty computation.
BOE Creation from Manifest
featureLegacy-compatible Bills of Entry creation from manifest data with comprehensive analysis and automatic field mapping.
Shipping Marks Auto-Population
featureIntelligent shipping marks auto-population system with legacy compatibility and comprehensive container-to-item mapping.
Key Highlights:
- 🧭 New HS code requests navigation
- 💰 Pricing disclaimer for transparency
- 🎨 Improved user interface elements
Detailed Changes:
HS Code Requests Navigation
featureAdded dedicated navigation link for HS code requests in the admin menu for better accessibility.
Pricing Disclaimer
enhancementAdded prominent disclaimer on pricing page to clarify demo pricing vs actual costs.
Key Highlights:
- 🔍 Advanced HS code search and preservation
- 📝 User-driven update request system
- ⚡ Performance optimized code lookup
- 🔄 Comprehensive code validation
Detailed Changes:
HS Code Preservation System
featureImplemented comprehensive system to preserve user-selected HS codes during imports and updates, preventing data loss.
HS Code Update Requests
featureNew user-driven system allowing users to request HS code updates with admin review and approval workflow.
Performance Optimized Search
enhancementEnhanced HS code search with better caching and faster lookup performance for improved user experience.
Key Highlights:
- 🐛 TypeScript compilation fixes
- 🔐 Enhanced auth middleware
- ⚡ Improved system stability
Detailed Changes:
TypeScript Compilation Errors
fixResolved various TypeScript compilation issues for better development experience and build stability.
Auth Middleware Refactor
enhancementImproved authentication middleware for better security and performance.
Key Highlights:
- 🛡️ Full RBAC implementation
- 📊 Comprehensive audit logging
- 👥 Role-based permissions
- 🔍 User activity tracking
Detailed Changes:
Role-Based Access Control
featureImplemented comprehensive RBAC system with roles, permissions, and resource-based access control.
Audit Capabilities
featureAdded comprehensive audit logging system to track user actions and system changes for compliance and security.
Key Highlights:
- 🧮 Advanced auto-calculation engine
- 🔄 Legacy system compatibility
- ⚡ Performance optimized processing
- 📊 Accurate duty calculations
Detailed Changes:
Legacy Auto-Calculation Engine
featureImplemented comprehensive auto-calculation system compatible with legacy BOE processing requirements.
Key Highlights:
- 📦 Legacy-compatible BOE creation from manifest
- 🏷️ Auto-population of shipping marks
- 🔄 Comprehensive manifest analysis
- ⚡ Streamlined import workflow
Detailed Changes:
Legacy-Compatible BOE Creation
featureImplemented BOE creation from manifest data with full legacy system compatibility and comprehensive analysis.
Auto-Population of Shipping Marks
featureAdded comprehensive shipping marks auto-population with legacy compatibility for streamlined data entry.
Stay Updated
This changelog is automatically updated with each release. For technical details, check our git commit history.