- departments.service.test.ts: 43 test cases covering CRUD, job positions, and validation errors
- contracts.service.test.ts: 40 test cases covering lifecycle (draft->active->terminated), cancellation, and validation
- leaves.service.test.ts: 66 test cases covering leave types and leave requests with status transitions
Coverage results: departments 100%, contracts 100%, leaves 96.1%
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- warehouses.service.ts: Add code uniqueness check with tenantId
- products.service.ts: Add SKU/barcode uniqueness checks with tenantId
- accounts.service.ts: Add tenantId to code and parent validation
Fixes 5 RLS gaps in backend services for multi-tenant isolation.
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>
Add TypeORM entity and DTOs for Projects timesheets feature:
- TimesheetEntity with all fields matching DDL schema
- Extended DTOs for bulk operations (submit, approve, reject)
- Summary types for reporting (by project, user, task)
- Updated module exports to include new files
Complements existing timesheets.service.ts implementation.
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>
- Add CouponsService for discount coupon management
- Add PlanLimitsService for plan limit validation
- Add StripeWebhookService for Stripe event processing
- Add plan-enforcement middleware (requireLimit, requireFeature, planBasedRateLimit)
- Add 68 unit tests for all billing-usage services
- Update TenantSubscription entity with Stripe integration fields
- Export new services from module index
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>
Add comprehensive unit tests for Business Core modules:
- Partners: 22 tests (CRUD, filters, tenant isolation)
- Products: 23 tests (CRUD, categories, search)
- Invoices: 31 tests (CRUD, payments, state transitions)
- Warehouses: 24 tests (CRUD, locations, default handling)
- HR Employees: 24 tests (CRUD, terminate/reactivate, subordinates)
Test infrastructure:
- jest.config.js with ts-jest and ESM support
- setup.ts with mocks for AppDataSource and database
- helpers.ts with factory functions for test data
Total: 114 tests passing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create invoices.controller.ts and invoices.routes.ts with singleton service
- Create products.service.ts, products.controller.ts, products.routes.ts
- Create warehouses.service.ts, warehouses.controller.ts, warehouses.routes.ts
- Register all routes in app.ts
- Use Zod validation schemas in all controllers
- Apply multi-tenant isolation via tenantId
- Update invoices.module.ts to use singleton pattern
All business modules now have API routes registered and build passes.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add deprecation notice to inventory/warehouse.entity.ts
- Duplicated with warehouses/warehouse.entity.ts (same table)
- Plan unification in warehouses module with all fields and relations
- Document that Product entities are NOT duplicates
- products.products: Commerce/retail focused (SAT, pricing, dimensions)
- inventory.products: Warehouse management focused (Odoo-style, valuation)
- Intentionally separate by domain
- Fix api keys controller scope type handling
- Fix billing-usage invoices/subscriptions undefined assignments
- Fix branches service type casting
- Fix financial controller Zod schemas (accounts camelCase, journals snake_case)
- Fix inventory controller with type assertions for enums
- Fix valuation controller meta type
- Fix notifications service channel type casting
- Fix payment-terminals transactions service undefined assignments
- Fix CircuitBreaker constructor signature
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>