47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { type SetupParams, buildCatalogs, buildTransactionManager } from "@erp/core/api";
|
|
import type { ProformaPublicServices } from "@erp/customer-invoices/api";
|
|
import type { CustomerPublicServices } from "@erp/customers/api";
|
|
|
|
import {
|
|
buildCreateProformaFromFactugesUseCase,
|
|
buildFactugesInputMappers,
|
|
} from "../../application/di";
|
|
import type { CreateProformaFromFactugesUseCase } from "../../application/use-cases";
|
|
|
|
export type FactugesInternalDeps = {
|
|
useCases: {
|
|
createProforma: (publicServices: {
|
|
customerServices: CustomerPublicServices;
|
|
proformaServices: ProformaPublicServices;
|
|
}) => 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: {
|
|
customerServices: CustomerPublicServices;
|
|
proformaServices: ProformaPublicServices;
|
|
}) => {
|
|
return buildCreateProformaFromFactugesUseCase({
|
|
dtoMapper: inputMappers.createInputMapper,
|
|
publicServices,
|
|
catalogs,
|
|
transactionManager,
|
|
});
|
|
},
|
|
},
|
|
};
|
|
}
|