47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
|
|
import type { IModuleServer } from "@erp/core/api";
|
||
|
|
|
||
|
|
import type { ICompanyPublicServices } from "./application";
|
||
|
|
import { companiesRouter, models } from "./infrastructure";
|
||
|
|
import { buildCompaniesDependencies, buildCompaniesPublicServices } from "./infrastructure/di";
|
||
|
|
|
||
|
|
export type { ICompanyPublicServices } from "./application";
|
||
|
|
export * from "./application";
|
||
|
|
export * from "./domain";
|
||
|
|
export * from "./infrastructure";
|
||
|
|
export * from "./infrastructure/persistence/sequelize";
|
||
|
|
export type CompaniesPublicServicesType = ICompanyPublicServices;
|
||
|
|
|
||
|
|
export const companiesAPIModule: IModuleServer = {
|
||
|
|
name: "companies",
|
||
|
|
version: "1.0.0",
|
||
|
|
dependencies: ["identity"],
|
||
|
|
|
||
|
|
async setup(params) {
|
||
|
|
const { logger } = params;
|
||
|
|
|
||
|
|
const internal = buildCompaniesDependencies(params);
|
||
|
|
const companiesServices: ICompanyPublicServices = buildCompaniesPublicServices(
|
||
|
|
params,
|
||
|
|
internal
|
||
|
|
);
|
||
|
|
|
||
|
|
logger.info("🚀 Companies module dependencies registered", {
|
||
|
|
label: this.name,
|
||
|
|
});
|
||
|
|
|
||
|
|
return {
|
||
|
|
models,
|
||
|
|
services: {
|
||
|
|
general: companiesServices,
|
||
|
|
},
|
||
|
|
internal,
|
||
|
|
};
|
||
|
|
},
|
||
|
|
|
||
|
|
async start(params) {
|
||
|
|
companiesRouter(params);
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export default companiesAPIModule;
|