rwadurian/backend/services/wallet-service/src/infrastructure/infrastructure.module.ts

59 lines
1.6 KiB
TypeScript

import { Module, Global } from '@nestjs/common';
import { PrismaService } from './persistence/prisma/prisma.service';
import {
WalletAccountRepositoryImpl,
LedgerEntryRepositoryImpl,
DepositOrderRepositoryImpl,
SettlementOrderRepositoryImpl,
WithdrawalOrderRepositoryImpl,
PendingRewardRepositoryImpl,
FeeConfigRepositoryImpl,
} from './persistence/repositories';
import {
WALLET_ACCOUNT_REPOSITORY,
LEDGER_ENTRY_REPOSITORY,
DEPOSIT_ORDER_REPOSITORY,
SETTLEMENT_ORDER_REPOSITORY,
WITHDRAWAL_ORDER_REPOSITORY,
PENDING_REWARD_REPOSITORY,
} from '@/domain/repositories';
import { RedisModule } from './redis';
import { KafkaModule } from './kafka';
import { IdentityModule } from './external/identity';
const repositories = [
{
provide: WALLET_ACCOUNT_REPOSITORY,
useClass: WalletAccountRepositoryImpl,
},
{
provide: LEDGER_ENTRY_REPOSITORY,
useClass: LedgerEntryRepositoryImpl,
},
{
provide: DEPOSIT_ORDER_REPOSITORY,
useClass: DepositOrderRepositoryImpl,
},
{
provide: SETTLEMENT_ORDER_REPOSITORY,
useClass: SettlementOrderRepositoryImpl,
},
{
provide: WITHDRAWAL_ORDER_REPOSITORY,
useClass: WithdrawalOrderRepositoryImpl,
},
{
provide: PENDING_REWARD_REPOSITORY,
useClass: PendingRewardRepositoryImpl,
},
FeeConfigRepositoryImpl,
];
@Global()
@Module({
imports: [RedisModule, KafkaModule, IdentityModule],
providers: [PrismaService, ...repositories],
exports: [PrismaService, RedisModule, KafkaModule, IdentityModule, FeeConfigRepositoryImpl, ...repositories],
})
export class InfrastructureModule {}