Uecko_ERP/modules/factuges/src/api/infraestructure/di/factuges.di.ts

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-03-16 17:45:45 +00:00
import { type SetupParams, buildCatalogs, buildTransactionManager } from "@erp/core/api";
2026-05-04 18:33:24 +00:00
import type { IProformaPublicServices } from "@erp/customer-invoices/api";
import type { ICustomerPublicServices } from "@erp/customers/api";
2026-03-16 17:45:45 +00:00
import {
buildCreateProformaFromFactugesUseCase,
buildFactugesInputMappers,
} from "../../application/di";
import type { CreateProformaFromFactugesUseCase } from "../../application/use-cases";
export type FactugesInternalDeps = {
useCases: {
createProforma: (publicServices: {
2026-05-04 18:33:24 +00:00
customerServices: ICustomerPublicServices;
proformaServices: IProformaPublicServices;
2026-03-16 17:45:45 +00:00
}) => CreateProformaFromFactugesUseCase;
};
};
export function buildFactugesDependencies(params: SetupParams): FactugesInternalDeps {
const { database } = params;
// Infrastructure
const transactionManager = buildTransactionManager(database);
const catalogs = buildCatalogs();
// Application helpers
const inputMappers = buildFactugesInputMappers(catalogs);
// Internal use cases (factories)
return {
useCases: {
createProforma: (publicServices: {
2026-05-04 18:33:24 +00:00
customerServices: ICustomerPublicServices;
proformaServices: IProformaPublicServices;
2026-03-28 21:10:05 +00:00
}) =>
buildCreateProformaFromFactugesUseCase({
2026-03-16 17:45:45 +00:00
dtoMapper: inputMappers.createInputMapper,
publicServices,
catalogs,
transactionManager,
2026-03-28 21:10:05 +00:00
}),
2026-03-16 17:45:45 +00:00
},
};
}