From e719feaadfcb4c395cca7affa1c905fbb4563b1b Mon Sep 17 00:00:00 2001 From: david Date: Sat, 4 Oct 2025 19:43:03 +0200 Subject: [PATCH] Clientes y facturas de cliente --- modules/customer-invoices/src/api/application/index.ts | 1 + .../mappers/domain/customer-invoice-item.mapper.ts | 2 +- .../mappers/domain/customer-invoice.mapper.ts | 8 ++------ .../api/infrastructure/mappers/domain/customer.mapper.ts | 4 +--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/customer-invoices/src/api/application/index.ts b/modules/customer-invoices/src/api/application/index.ts index 8643bc2a..381b2a83 100644 --- a/modules/customer-invoices/src/api/application/index.ts +++ b/modules/customer-invoices/src/api/application/index.ts @@ -1,2 +1,3 @@ +export * from "./customer-invoice-application.service"; export * from "./presenters"; export * from "./use-cases"; diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts index 846b2fe6..9fbbb5cc 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts @@ -163,7 +163,7 @@ export class CustomerInvoiceItemDomainMapper if (createResult.isFailure) { return Result.fail( - new ValidationErrorCollection("Invoice item entity creation failed", [ + new ValidationErrorCollection([ { path: `items[${index}]`, message: createResult.error.message }, ]) ); diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts index f3c32563..c78d9dc9 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts @@ -274,9 +274,7 @@ export class CustomerInvoiceDomainMapper // 5) Si hubo errores de mapeo, devolvemos colección de validación if (errors.length > 0) { - return Result.fail( - new ValidationErrorCollection("Customer invoice mapping failed [mapToDomain]", errors) - ); + return Result.fail(new ValidationErrorCollection(errors)); } // 6) Construcción del agregado (Dominio) @@ -321,9 +319,7 @@ export class CustomerInvoiceDomainMapper if (createResult.isFailure) { return Result.fail( - new ValidationErrorCollection("Customer invoice entity creation failed", [ - { path: "invoice", message: createResult.error.message }, - ]) + new ValidationErrorCollection([{ path: "invoice", message: createResult.error.message }]) ); } diff --git a/modules/customers/src/api/infrastructure/mappers/domain/customer.mapper.ts b/modules/customers/src/api/infrastructure/mappers/domain/customer.mapper.ts index 9e4465ef..e3adbaf6 100644 --- a/modules/customers/src/api/infrastructure/mappers/domain/customer.mapper.ts +++ b/modules/customers/src/api/infrastructure/mappers/domain/customer.mapper.ts @@ -197,9 +197,7 @@ export class CustomerDomainMapper // Si hubo errores de mapeo, devolvemos colección de validación if (errors.length > 0) { - return Result.fail( - new ValidationErrorCollection("Customer props mapping failed (CustomerMapper)", errors) - ); + return Result.fail(new ValidationErrorCollection(errors)); } const customerProps: CustomerProps = {