diff --git a/modules/customers/src/api/domain/aggregates/customer.aggregate.ts b/modules/customers/src/api/domain/aggregates/customer.aggregate.ts index 6eff0bff..8ac18328 100644 --- a/modules/customers/src/api/domain/aggregates/customer.aggregate.ts +++ b/modules/customers/src/api/domain/aggregates/customer.aggregate.ts @@ -81,9 +81,10 @@ export interface ICustomer { readonly phoneSecondary: Maybe; readonly mobilePrimary: Maybe; readonly mobileSecondary: Maybe; - readonly fax: Maybe; + readonly fax: Maybe; readonly website: Maybe; + readonly legalRecord: Maybe; readonly defaultTaxes: CustomerTaxes; diff --git a/modules/customers/src/api/index.ts b/modules/customers/src/api/index.ts index 90c5d699..181bec0e 100644 --- a/modules/customers/src/api/index.ts +++ b/modules/customers/src/api/index.ts @@ -4,7 +4,7 @@ import type { ICustomerPublicServices } from "./application"; import { customersRouter, models } from "./infrastructure"; import { buildCustomerPublicServices, buildCustomersDependencies } from "./infrastructure/di"; -export * from "./infrastructure/sequelize"; +export * from "./infrastructure/persistence/sequelize"; export const customersAPIModule: IModuleServer = { name: "customers", diff --git a/modules/customers/src/api/infrastructure/di/customer-persistence-mappers.di.ts b/modules/customers/src/api/infrastructure/di/customer-persistence-mappers.di.ts index 1c669298..552ec51b 100644 --- a/modules/customers/src/api/infrastructure/di/customer-persistence-mappers.di.ts +++ b/modules/customers/src/api/infrastructure/di/customer-persistence-mappers.di.ts @@ -1,6 +1,6 @@ import type { ICatalogs } from "@erp/core/api"; -import { SequelizeCustomerDomainMapper, SequelizeCustomerSummaryMapper } from "../mappers"; +import { SequelizeCustomerDomainMapper, SequelizeCustomerSummaryMapper } from "../persistence"; export interface ICustomerPersistenceMappers { domainMapper: SequelizeCustomerDomainMapper; diff --git a/modules/customers/src/api/infrastructure/di/customer-repositories.di.ts b/modules/customers/src/api/infrastructure/di/customer-repositories.di.ts index e1c893ce..fdc74d9f 100644 --- a/modules/customers/src/api/infrastructure/di/customer-repositories.di.ts +++ b/modules/customers/src/api/infrastructure/di/customer-repositories.di.ts @@ -1,6 +1,6 @@ import type { Sequelize } from "sequelize"; -import { CustomerRepository } from "../sequelize"; +import { CustomerRepository } from "../persistence/sequelize"; import type { ICustomerPersistenceMappers } from "./customer-persistence-mappers.di"; diff --git a/modules/customers/src/api/infrastructure/express/customer-api-error-mapper.ts b/modules/customers/src/api/infrastructure/express/customer-api-error-mapper.ts index bf9489b9..58b1add7 100644 --- a/modules/customers/src/api/infrastructure/express/customer-api-error-mapper.ts +++ b/modules/customers/src/api/infrastructure/express/customer-api-error-mapper.ts @@ -1,5 +1,6 @@ -import { ApiErrorMapper, ErrorToApiRule, NotFoundApiError } from "@erp/core/api"; -import { CustomerNotFoundError, isCustomerNotFoundError } from "../../domain"; +import { ApiErrorMapper, type ErrorToApiRule, NotFoundApiError } from "@erp/core/api"; + +import { type CustomerNotFoundError, isCustomerNotFoundError } from "../../domain"; // Crea una regla especĂ­fica (prioridad alta para sobreescribir mensajes) const customerNotFoundRule: ErrorToApiRule = { diff --git a/modules/customers/src/api/infrastructure/index.ts b/modules/customers/src/api/infrastructure/index.ts index 610844a7..3e34d105 100644 --- a/modules/customers/src/api/infrastructure/index.ts +++ b/modules/customers/src/api/infrastructure/index.ts @@ -1,4 +1,3 @@ export * from "./di"; export * from "./express"; -export * from "./mappers"; -export * from "./sequelize"; +export * from "./persistence"; diff --git a/modules/customers/src/api/infrastructure/persistence/index.ts b/modules/customers/src/api/infrastructure/persistence/index.ts new file mode 100644 index 00000000..62f8ac11 --- /dev/null +++ b/modules/customers/src/api/infrastructure/persistence/index.ts @@ -0,0 +1 @@ +export * from "./sequelize"; diff --git a/modules/customers/src/api/infrastructure/sequelize/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/index.ts similarity index 63% rename from modules/customers/src/api/infrastructure/sequelize/index.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/index.ts index 6d88de41..cc853571 100644 --- a/modules/customers/src/api/infrastructure/sequelize/index.ts +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/index.ts @@ -1,5 +1,6 @@ -import customerModelInit from "./models/customer.model"; +import customerModelInit from "./models/sequelize-customer.model"; +export * from "./mappers"; export * from "./models"; export * from "./repositories"; diff --git a/modules/customers/src/api/infrastructure/mappers/domain/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/domain/index.ts similarity index 100% rename from modules/customers/src/api/infrastructure/mappers/domain/index.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/mappers/domain/index.ts diff --git a/modules/customers/src/api/infrastructure/mappers/domain/sequelize-customer.mapper.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/domain/sequelize-customer.mapper.ts similarity index 99% rename from modules/customers/src/api/infrastructure/mappers/domain/sequelize-customer.mapper.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/mappers/domain/sequelize-customer.mapper.ts index aee1a2d2..96136bdc 100644 --- a/modules/customers/src/api/infrastructure/mappers/domain/sequelize-customer.mapper.ts +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/domain/sequelize-customer.mapper.ts @@ -29,8 +29,8 @@ import { CustomerStatus, CustomerTaxes, type ICustomerCreateProps, -} from "../../../domain"; -import type { CustomerCreationAttributes, CustomerModel } from "../../sequelize"; +} from "../../../../../domain"; +import type { CustomerCreationAttributes, CustomerModel } from "../../models"; export class SequelizeCustomerDomainMapper extends SequelizeDomainMapper< CustomerModel, diff --git a/modules/customers/src/api/infrastructure/mappers/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/index.ts similarity index 100% rename from modules/customers/src/api/infrastructure/mappers/index.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/mappers/index.ts diff --git a/modules/customers/src/api/infrastructure/mappers/summary/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/summary/index.ts similarity index 100% rename from modules/customers/src/api/infrastructure/mappers/summary/index.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/mappers/summary/index.ts diff --git a/modules/customers/src/api/infrastructure/mappers/summary/sequelize-customer-summary.mapper.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/summary/sequelize-customer-summary.mapper.ts similarity index 97% rename from modules/customers/src/api/infrastructure/mappers/summary/sequelize-customer-summary.mapper.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/mappers/summary/sequelize-customer-summary.mapper.ts index 41bd9699..894a8dad 100644 --- a/modules/customers/src/api/infrastructure/mappers/summary/sequelize-customer-summary.mapper.ts +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/mappers/summary/sequelize-customer-summary.mapper.ts @@ -22,9 +22,9 @@ import { } from "@repo/rdx-ddd"; import { Result } from "@repo/rdx-utils"; -import type { CustomerSummary } from "../../../application"; -import { CustomerStatus } from "../../../domain"; -import type { CustomerModel } from "../../sequelize"; +import type { CustomerSummary } from "../../../../../application"; +import { CustomerStatus } from "../../../../../domain"; +import type { CustomerModel } from "../../models"; export class SequelizeCustomerSummaryMapper extends SequelizeQueryMapper< CustomerModel, diff --git a/modules/customers/src/api/infrastructure/persistence/sequelize/models/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/models/index.ts new file mode 100644 index 00000000..bda1e3f7 --- /dev/null +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/models/index.ts @@ -0,0 +1 @@ +export * from "./sequelize-customer.model"; diff --git a/modules/customers/src/api/infrastructure/sequelize/models/customer.model.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/models/sequelize-customer.model.ts similarity index 100% rename from modules/customers/src/api/infrastructure/sequelize/models/customer.model.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/models/sequelize-customer.model.ts diff --git a/modules/customers/src/api/infrastructure/sequelize/repositories/customer.repository.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts similarity index 98% rename from modules/customers/src/api/infrastructure/sequelize/repositories/customer.repository.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts index 218a7be6..a5427728 100644 --- a/modules/customers/src/api/infrastructure/sequelize/repositories/customer.repository.ts +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts @@ -9,10 +9,10 @@ import type { TINNumber, UniqueID } from "@repo/rdx-ddd"; import { type Collection, Result } from "@repo/rdx-utils"; import type { FindOptions, InferAttributes, OrderItem, Sequelize, Transaction } from "sequelize"; -import type { CustomerSummary, ICustomerRepository } from "../../../application"; -import type { Customer } from "../../../domain"; +import type { CustomerSummary, ICustomerRepository } from "../../../../application"; +import type { Customer } from "../../../../domain"; import type { SequelizeCustomerDomainMapper, SequelizeCustomerSummaryMapper } from "../../mappers"; -import { CustomerModel } from "../models/customer.model"; +import { CustomerModel } from "../models/sequelize-customer.model"; export class CustomerRepository extends SequelizeRepository diff --git a/modules/customers/src/api/infrastructure/sequelize/repositories/index.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/index.ts similarity index 100% rename from modules/customers/src/api/infrastructure/sequelize/repositories/index.ts rename to modules/customers/src/api/infrastructure/persistence/sequelize/repositories/index.ts diff --git a/modules/customers/src/api/infrastructure/sequelize/models/index.ts b/modules/customers/src/api/infrastructure/sequelize/models/index.ts deleted file mode 100644 index 8141c8ae..00000000 --- a/modules/customers/src/api/infrastructure/sequelize/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./customer.model";