- Partners: Moved services to services/ directory, consolidated duplicates,
kept singleton pattern version with ranking service
- Products: Moved service to services/, removed duplicate class-based version,
kept singleton with deletedAt filtering
- Reports: Moved service to services/, kept raw SQL version for active controller
- Warehouses: Moved service to services/, removed duplicate class-based version,
kept singleton with proper tenant isolation
All modules now follow consistent structure:
- services/*.service.ts for business logic
- services/index.ts for exports
- Controllers import from ./services/index.js
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EPIC-P2-005: UOM Multi-tenancy Sync
- Add tenant_id field to Uom entity
- Add tenant_id field to UomCategory entity
- Add Tenant relation to both entities
- Add UpdateDateColumn for updated_at
- Update indexes for tenant-based unique constraints
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- State entity and service with CRUD operations
- CurrencyRate entity and service with conversion support
- UoM conversion methods (convertQuantity, getConversionTable)
- New API endpoints for states, currency rates, UoM conversions
- Updated controller and routes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EPIC-001: Complete Core Module
- Add PaymentTerm entity with multi-line support (30/60/90 days, early payment discounts)
- Add PaymentTerms service with calculateDueDate() functionality
- Add DiscountRule entity with volume/time-based conditions
- Add DiscountRules service with applyDiscounts() and rule combination logic
- Add REST endpoints for payment-terms and discount-rules in core module
- Register new entities in TypeORM configuration
EPIC-002: Entity Consolidation
- Add inventoryProductId FK to products.products for linking to inventory module
- Consolidate Warehouse entity in warehouses module as canonical source
- Add companyId and Location relation to canonical Warehouse
- Update inventory module to re-export Warehouse from warehouses module
- Remove deprecated warehouse.entity.ts from inventory module
- Update inventory/warehouses.service.ts to use canonical Warehouse
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>