18 lines
847 B
TypeScript
18 lines
847 B
TypeScript
|
|
import { SequelizeTransactionManager } from "@erp/core/api";
|
||
|
|
import { Sequelize } from "sequelize";
|
||
|
|
import { CreateCustomerUseCase, CreateCustomersPresenter } from "../../application/";
|
||
|
|
import { CustomerService } from "../../domain";
|
||
|
|
import { CustomerMapper } from "../../infrastructure";
|
||
|
|
import { CreateCustomerController } from "./create-customer";
|
||
|
|
|
||
|
|
export const buildCreateCustomersController = (database: Sequelize) => {
|
||
|
|
const transactionManager = new SequelizeTransactionManager(database);
|
||
|
|
const customerRepository = new customerRepository(database, new CustomerMapper());
|
||
|
|
const customerService = new CustomerService(customerRepository);
|
||
|
|
const presenter = new CreateCustomersPresenter();
|
||
|
|
|
||
|
|
const useCase = new CreateCustomerUseCase(customerService, transactionManager, presenter);
|
||
|
|
|
||
|
|
return new CreateCustomerController(useCase);
|
||
|
|
};
|