From 7f77b18d52e36a6abc5b8df090a792044c58adf4 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 17 Feb 2026 15:32:50 +0100 Subject: [PATCH] . --- .../customer-invoices/src/api/domain/errors/index.ts | 5 ----- .../aggregates/issued-invoice.aggregate.ts | 7 +++---- .../errors/customer-invoice-id-already-exits-error.ts | 0 .../errors/entity-is-not-proforma-error.ts | 0 .../src/api/domain/proformas/errors/index.ts | 5 +++++ .../errors/invalid-proforma-transition-error.ts | 0 .../proforma-cannot-be-converted-to-invoice-error.ts | 0 .../errors/proforma-cannot-be-deleted-error.ts | 0 .../express/proformas/proformas-api-error-mapper.ts | 2 +- .../list-issued-invoices.response.dto.ts | 10 ++-------- 10 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 modules/customer-invoices/src/api/domain/errors/index.ts rename modules/customer-invoices/src/api/domain/{ => proformas}/errors/customer-invoice-id-already-exits-error.ts (100%) rename modules/customer-invoices/src/api/domain/{ => proformas}/errors/entity-is-not-proforma-error.ts (100%) rename modules/customer-invoices/src/api/domain/{ => proformas}/errors/invalid-proforma-transition-error.ts (100%) rename modules/customer-invoices/src/api/domain/{ => proformas}/errors/proforma-cannot-be-converted-to-invoice-error.ts (100%) rename modules/customer-invoices/src/api/domain/{ => proformas}/errors/proforma-cannot-be-deleted-error.ts (100%) diff --git a/modules/customer-invoices/src/api/domain/errors/index.ts b/modules/customer-invoices/src/api/domain/errors/index.ts deleted file mode 100644 index 5d141a19..00000000 --- a/modules/customer-invoices/src/api/domain/errors/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./customer-invoice-id-already-exits-error"; -export * from "./entity-is-not-proforma-error"; -export * from "./invalid-proforma-transition-error"; -export * from "./proforma-cannot-be-converted-to-invoice-error"; -export * from "./proforma-cannot-be-deleted-error"; diff --git a/modules/customer-invoices/src/api/domain/issued-invoices/aggregates/issued-invoice.aggregate.ts b/modules/customer-invoices/src/api/domain/issued-invoices/aggregates/issued-invoice.aggregate.ts index b8b75084..b03cf056 100644 --- a/modules/customer-invoices/src/api/domain/issued-invoices/aggregates/issued-invoice.aggregate.ts +++ b/modules/customer-invoices/src/api/domain/issued-invoices/aggregates/issued-invoice.aggregate.ts @@ -10,16 +10,15 @@ import { } from "@repo/rdx-ddd"; import { type Maybe, Result } from "@repo/rdx-utils"; -import type { InvoicePaymentMethod } from "../common/entities"; import type { InvoiceAmount, InvoiceNumber, + InvoicePaymentMethod, InvoiceRecipient, InvoiceSerie, InvoiceStatus, -} from "../common/value-objects"; - -import { IssuedInvoiceItems, type IssuedInvoiceTaxes, type VerifactuRecord } from "./entities"; +} from "../../common"; +import { IssuedInvoiceItems, type IssuedInvoiceTaxes, type VerifactuRecord } from "../entities"; export type IssuedInvoiceProps = { companyId: UniqueID; diff --git a/modules/customer-invoices/src/api/domain/errors/customer-invoice-id-already-exits-error.ts b/modules/customer-invoices/src/api/domain/proformas/errors/customer-invoice-id-already-exits-error.ts similarity index 100% rename from modules/customer-invoices/src/api/domain/errors/customer-invoice-id-already-exits-error.ts rename to modules/customer-invoices/src/api/domain/proformas/errors/customer-invoice-id-already-exits-error.ts diff --git a/modules/customer-invoices/src/api/domain/errors/entity-is-not-proforma-error.ts b/modules/customer-invoices/src/api/domain/proformas/errors/entity-is-not-proforma-error.ts similarity index 100% rename from modules/customer-invoices/src/api/domain/errors/entity-is-not-proforma-error.ts rename to modules/customer-invoices/src/api/domain/proformas/errors/entity-is-not-proforma-error.ts diff --git a/modules/customer-invoices/src/api/domain/proformas/errors/index.ts b/modules/customer-invoices/src/api/domain/proformas/errors/index.ts index e69de29b..5d141a19 100644 --- a/modules/customer-invoices/src/api/domain/proformas/errors/index.ts +++ b/modules/customer-invoices/src/api/domain/proformas/errors/index.ts @@ -0,0 +1,5 @@ +export * from "./customer-invoice-id-already-exits-error"; +export * from "./entity-is-not-proforma-error"; +export * from "./invalid-proforma-transition-error"; +export * from "./proforma-cannot-be-converted-to-invoice-error"; +export * from "./proforma-cannot-be-deleted-error"; diff --git a/modules/customer-invoices/src/api/domain/errors/invalid-proforma-transition-error.ts b/modules/customer-invoices/src/api/domain/proformas/errors/invalid-proforma-transition-error.ts similarity index 100% rename from modules/customer-invoices/src/api/domain/errors/invalid-proforma-transition-error.ts rename to modules/customer-invoices/src/api/domain/proformas/errors/invalid-proforma-transition-error.ts diff --git a/modules/customer-invoices/src/api/domain/errors/proforma-cannot-be-converted-to-invoice-error.ts b/modules/customer-invoices/src/api/domain/proformas/errors/proforma-cannot-be-converted-to-invoice-error.ts similarity index 100% rename from modules/customer-invoices/src/api/domain/errors/proforma-cannot-be-converted-to-invoice-error.ts rename to modules/customer-invoices/src/api/domain/proformas/errors/proforma-cannot-be-converted-to-invoice-error.ts diff --git a/modules/customer-invoices/src/api/domain/errors/proforma-cannot-be-deleted-error.ts b/modules/customer-invoices/src/api/domain/proformas/errors/proforma-cannot-be-deleted-error.ts similarity index 100% rename from modules/customer-invoices/src/api/domain/errors/proforma-cannot-be-deleted-error.ts rename to modules/customer-invoices/src/api/domain/proformas/errors/proforma-cannot-be-deleted-error.ts diff --git a/modules/customer-invoices/src/api/infrastructure/express/proformas/proformas-api-error-mapper.ts b/modules/customer-invoices/src/api/infrastructure/express/proformas/proformas-api-error-mapper.ts index 0347011d..243ac245 100644 --- a/modules/customer-invoices/src/api/infrastructure/express/proformas/proformas-api-error-mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/express/proformas/proformas-api-error-mapper.ts @@ -7,7 +7,6 @@ import { type ErrorToApiRule, ValidationApiError, } from "@erp/core/api"; -import { isProformaCannotBeDeletedError } from "@erp/customer-invoices/api/domain/errors"; import { type CustomerInvoiceIdAlreadyExistsError, @@ -18,6 +17,7 @@ import { isEntityIsNotProformaError, isInvalidProformaTransitionError, isProformaCannotBeConvertedToInvoiceError, + isProformaCannotBeDeletedError, } from "../../../domain"; // Crea una regla especĂ­fica (prioridad alta para sobreescribir mensajes) diff --git a/modules/customer-invoices/src/common/dto/response/issued-invoices/list-issued-invoices.response.dto.ts b/modules/customer-invoices/src/common/dto/response/issued-invoices/list-issued-invoices.response.dto.ts index 23c4f5e9..a495c9fb 100644 --- a/modules/customer-invoices/src/common/dto/response/issued-invoices/list-issued-invoices.response.dto.ts +++ b/modules/customer-invoices/src/common/dto/response/issued-invoices/list-issued-invoices.response.dto.ts @@ -1,9 +1,4 @@ -import { - MetadataSchema, - MoneySchema, - PercentageSchema, - createPaginatedListSchema, -} from "@erp/core"; +import { MetadataSchema, MoneySchema, createPaginatedListSchema } from "@erp/core"; import { z } from "zod/v4"; export const ListIssuedInvoicesResponseSchema = createPaginatedListSchema( @@ -39,8 +34,7 @@ export const ListIssuedInvoicesResponseSchema = createPaginatedListSchema( }), subtotal_amount: MoneySchema, - discount_percentage: PercentageSchema, - discount_amount: MoneySchema, + total_discount_amount: MoneySchema, taxable_amount: MoneySchema, taxes_amount: MoneySchema, total_amount: MoneySchema,