import { Global, Module } from '@nestjs/common'; import { CUSTOMER_DIRECTORY } from '../../common/security/scope/customer-directory'; import { CustomerFieldsController, CustomerFieldsOfCustomerController, } from './customer-fields.controller'; import { CustomerFieldsService } from './customer-fields.service'; import { CustomerGroupsController } from './customer-groups.controller'; import { CustomerGroupsService } from './customer-groups.service'; import { CustomersController, CustomerTransferController } from './customers.controller'; import { CustomersService } from './customers.service'; import { IndustriesController } from './industries.controller'; import { IndustriesService } from './industries.service'; import { PrismaCustomerDirectory } from './prisma-customer-directory.service'; /** * client 模块(A3):两级行业、客户档案与状态机、客户组、客户级字段。 * * 全局导出 `CUSTOMER_DIRECTORY` 真实实现,供 SecurityModule 的 ScopeResolver 解析六类 * 数据范围;client 本身不反向依赖 security 模块,避免循环依赖。 */ @Global() @Module({ controllers: [ IndustriesController, CustomersController, CustomerTransferController, CustomerGroupsController, CustomerFieldsController, CustomerFieldsOfCustomerController, ], providers: [ IndustriesService, CustomersService, CustomerGroupsService, CustomerFieldsService, PrismaCustomerDirectory, { provide: CUSTOMER_DIRECTORY, useExisting: PrismaCustomerDirectory }, ], exports: [CUSTOMER_DIRECTORY, IndustriesService, CustomersService], }) export class ClientModule {}