71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import { Module, Global } from '@nestjs/common';
|
|
import { PrismaService } from './persistence/prisma/prisma.service';
|
|
import {
|
|
WalletAccountRepositoryImpl,
|
|
LedgerEntryRepositoryImpl,
|
|
DepositOrderRepositoryImpl,
|
|
SettlementOrderRepositoryImpl,
|
|
WithdrawalOrderRepositoryImpl,
|
|
FiatWithdrawalOrderRepositoryImpl,
|
|
PendingRewardRepositoryImpl,
|
|
FeeConfigRepositoryImpl,
|
|
} from './persistence/repositories';
|
|
import { UnitOfWorkService, UNIT_OF_WORK } from './persistence/unit-of-work';
|
|
import {
|
|
WALLET_ACCOUNT_REPOSITORY,
|
|
LEDGER_ENTRY_REPOSITORY,
|
|
DEPOSIT_ORDER_REPOSITORY,
|
|
SETTLEMENT_ORDER_REPOSITORY,
|
|
WITHDRAWAL_ORDER_REPOSITORY,
|
|
FIAT_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: FIAT_WITHDRAWAL_ORDER_REPOSITORY,
|
|
useClass: FiatWithdrawalOrderRepositoryImpl,
|
|
},
|
|
{
|
|
provide: PENDING_REWARD_REPOSITORY,
|
|
useClass: PendingRewardRepositoryImpl,
|
|
},
|
|
FeeConfigRepositoryImpl,
|
|
];
|
|
|
|
const unitOfWork = {
|
|
provide: UNIT_OF_WORK,
|
|
useClass: UnitOfWorkService,
|
|
};
|
|
|
|
@Global()
|
|
@Module({
|
|
imports: [RedisModule, KafkaModule, IdentityModule],
|
|
providers: [PrismaService, unitOfWork, ...repositories],
|
|
exports: [PrismaService, unitOfWork, RedisModule, KafkaModule, IdentityModule, FeeConfigRepositoryImpl, ...repositories],
|
|
})
|
|
export class InfrastructureModule {}
|