- Implemented `evaluateProformaCustomerChange` function to assess changes in customer details for proforma invoices. - Introduced types for customer change details, blockers, field differences, and fiscal targets. - Added utility functions for normalizing text and formatting recipient information. test: add unit tests for customer payment resolver - Created tests for `CustomerPaymentResolver` to validate payment term retrieval and handling of inactive terms. - Ensured proper behavior when clearing payment terms and handling non-existent terms. test: add unit tests for customer default payment term resolver - Developed tests for `CustomerDefaultPaymentTermResolver` to verify default payment term resolution logic. - Included scenarios for creating customers with and without explicit payment term IDs. feat: implement customer default payment term resolver - Created `CustomerDefaultPaymentTermResolver` to manage default payment term resolution during customer creation. - Integrated with company finder and payment resolver services. test: add unit tests for create customer use case - Implemented tests for `CreateCustomerUseCase` to ensure correct handling of payment term IDs during customer creation. - Validated behavior when no explicit payment term ID is provided. test: add unit tests for update customer use case - Developed tests for `UpdateCustomerUseCase` to verify payment term handling during customer updates. - Ensured that inactive payment terms are not assigned and that explicit null values are respected. feat: add dependency injection for customer company services - Implemented DI for customer company dependencies to facilitate service resolution. test: add tests for customer create data utility - Created tests for `buildCustomerCreateData` to validate payment term handling based on user input. |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
modules/companies
companies es el módulo independiente y fuente de verdad de la ficha operativa de empresa.
Responsabilidades
Gestiona la entidad Company funcional del ERP:
- datos legales
- datos operativos básicos
slugstatus
Separación arquitectónica:
modules/identity: autenticación, cuentas, memberships, acceso account-companymodules/companies: ficha real de empresa y validación de company activa
Tabla companies
Campos actuales:
id
legal_name
trade_name
tin
slug
email
phone
website
status
created_at
updated_at
Índices esperados:
UNIQUE(slug)
INDEX(status)
INDEX(tin)
Servicios públicos
El módulo expone:
companies:general
Responsabilidad:
- validar existencia y estado activo de la company
- devolver datos públicos/operativos de empresa
No debe asumir:
- memberships
- autenticación por cuenta
- roles/permisos de identity
Dependencias
modules/companies depende de identity.
Uso actual:
- sus endpoints usan
requireIdentityAuthenticated(params) GET /companies/availableno usarequireIdentityTenant(params)
Reglas
CompanyMembershipvive enidentity.- No mover memberships a
companies. - No usar
customerspara representar la empresa tenant. companySlugno debe venir de token,X-Company-Slugnireq.user.companySlug.