import { Module, Global } from '@nestjs/common'; import { HttpModule } from '@nestjs/axios'; import { ConfigModule } from '@nestjs/config'; import { PrismaService } from './persistence/prisma/prisma.service'; import { UserAccountRepositoryImpl } from './persistence/repositories/user-account.repository.impl'; import { MpcKeyShareRepositoryImpl } from './persistence/repositories/mpc-key-share.repository.impl'; import { UserAccountMapper } from './persistence/mappers/user-account.mapper'; import { RedisService } from './redis/redis.service'; import { EventPublisherService } from './kafka/event-publisher.service'; import { MpcEventConsumerService } from './kafka/mpc-event-consumer.service'; import { BlockchainEventConsumerService } from './kafka/blockchain-event-consumer.service'; import { SmsService } from './external/sms/sms.service'; import { EmailService } from './external/email/email.service'; import { BlockchainClientService } from './external/blockchain/blockchain-client.service'; import { MpcClientService, MpcWalletService } from './external/mpc'; import { StorageService } from './external/storage/storage.service'; import { MPC_KEY_SHARE_REPOSITORY } from '@/domain/repositories/mpc-key-share.repository.interface'; @Global() @Module({ imports: [ ConfigModule, HttpModule.register({ timeout: 300000, maxRedirects: 5, }), ], providers: [ PrismaService, UserAccountRepositoryImpl, { provide: MPC_KEY_SHARE_REPOSITORY, useClass: MpcKeyShareRepositoryImpl, }, UserAccountMapper, RedisService, EventPublisherService, MpcEventConsumerService, BlockchainEventConsumerService, SmsService, EmailService, // BlockchainClientService 调用 blockchain-service API BlockchainClientService, MpcClientService, MpcWalletService, StorageService, ], exports: [ PrismaService, UserAccountRepositoryImpl, { provide: MPC_KEY_SHARE_REPOSITORY, useClass: MpcKeyShareRepositoryImpl, }, UserAccountMapper, RedisService, EventPublisherService, MpcEventConsumerService, BlockchainEventConsumerService, SmsService, EmailService, BlockchainClientService, MpcClientService, MpcWalletService, StorageService, ], }) export class InfrastructureModule {}