Skip to content

Commit

Permalink
Merge pull request #55 from aura-nw/euphoria
Browse files Browse the repository at this point in the history
Euphoria
  • Loading branch information
harisato authored Aug 24, 2023
2 parents 5c0f11e + 3f20f44 commit 1b6617e
Show file tree
Hide file tree
Showing 13 changed files with 258 additions and 312 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pyxis-safe-sync",
"version": "0.5.2",
"version": "0.6.0",
"description": "",
"author": {
"name": "Aura Network",
Expand Down Expand Up @@ -99,4 +99,4 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
}
163 changes: 77 additions & 86 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable prettier/prettier */
import { Module } from '@nestjs/common';
import {
ENTITIES_CONFIG,
REPOSITORY_INTERFACE,
SERVICE_INTERFACE,
ENTITIES_CONFIG,
REPOSITORY_INTERFACE,
SERVICE_INTERFACE,
} from './module.config';
import { SyncWebsocketService } from './services/impls/sync-websocket.service';
import { SharedModule } from './shared/shared.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ConfigService } from './shared/services/config.service';
Expand All @@ -15,7 +14,6 @@ import { ChainRepository } from './repositories/impls/chain.repository';
import { ScheduleModule } from '@nestjs/schedule';
import { SyncRestService } from './services/impls/sync-rest.service';
import { HttpModule } from '@nestjs/axios';
import { AppController } from './controllers/websocket.controller';
import { MultisigTransactionRepository } from './repositories/impls/multisig-transaction.repository';
import { MessageRepository } from './repositories/impls/message.repository';
import { BullModule } from '@nestjs/bull';
Expand All @@ -25,90 +23,83 @@ import { RedisService } from './shared/services/redis.service';
import { CommonService } from './shared/services/common.service';
import { TransactionHistoryRepository } from './repositories/impls/tx-history.repository';
const entities = [
ENTITIES_CONFIG.AURA_TX,
ENTITIES_CONFIG.SAFE,
ENTITIES_CONFIG.CHAIN,
ENTITIES_CONFIG.MULTISIG_TRANSACTION,
ENTITIES_CONFIG.MESSAGE,
ENTITIES_CONFIG.TX_HISTORY,
ENTITIES_CONFIG.AURA_TX,
ENTITIES_CONFIG.SAFE,
ENTITIES_CONFIG.CHAIN,
ENTITIES_CONFIG.MULTISIG_TRANSACTION,
ENTITIES_CONFIG.MESSAGE,
ENTITIES_CONFIG.TX_HISTORY,
];
const controllers = [AppController];
const controllers = [];
const processors = [SyncRestProcessor];

@Module({
imports: [
ConfigModule.forRoot(),
SharedModule,
TypeOrmModule.forRootAsync({
imports: [SharedModule, AppModule],
useFactory: (configService: ConfigService) =>
configService.typeOrmConfig,
inject: [ConfigService],
}),
TypeOrmModule.forFeature([...entities]),
ScheduleModule.forRoot(),
HttpModule,
BullModule.forRoot({
redis: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
username: process.env.REDIS_USERNAME,
db: parseInt(process.env.REDIS_DB, 10),
},
prefix: `pyxis-safe-sync-${
JSON.parse(process.env.CHAIN_SUBCRIBE)[0]
}`,
defaultJobOptions: {
removeOnComplete: true,
attempts: 3,
},
}),
BullModule.registerQueue({
name: 'sync-rest',
}),
RedisService,
],
exports: [BullModule, ...processors],
controllers: [...controllers],
providers: [
// services
{
provide: SERVICE_INTERFACE.ISYNC_WEBSOCKET_SERVICE,
useClass: SyncWebsocketService,
},
{
provide: SERVICE_INTERFACE.ISYNC_REST_SERVICE,
useClass: SyncRestService,
},
RedisService,
CommonService,
// repositories
{
provide: REPOSITORY_INTERFACE.IAURA_TX_REPOSITORY,
useClass: AuraTxRepository,
},
{
provide: REPOSITORY_INTERFACE.ISAFE_REPOSITORY,
useClass: SafeRepository,
},
{
provide: REPOSITORY_INTERFACE.ICHAIN_REPOSITORY,
useClass: ChainRepository,
},
{
provide: REPOSITORY_INTERFACE.IMULTISIG_TRANSACTION_REPOSITORY,
useClass: MultisigTransactionRepository,
},
{
provide: REPOSITORY_INTERFACE.IMESSAGE_REPOSITORY,
useClass: MessageRepository,
},
{
provide: REPOSITORY_INTERFACE.ITX_HISTORY_REPOSITORY,
useClass: TransactionHistoryRepository,
},
// processors
...processors,
],
imports: [
ConfigModule.forRoot(),
SharedModule,
TypeOrmModule.forRootAsync({
imports: [SharedModule, AppModule],
useFactory: (configService: ConfigService) => configService.typeOrmConfig,
inject: [ConfigService],
}),
TypeOrmModule.forFeature([...entities]),
ScheduleModule.forRoot(),
HttpModule,
BullModule.forRoot({
redis: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
username: process.env.REDIS_USERNAME,
db: parseInt(process.env.REDIS_DB, 10),
},
prefix: `pyxis-safe-sync-${JSON.parse(process.env.CHAIN_SUBCRIBE)[0]}`,
defaultJobOptions: {
removeOnComplete: true,
attempts: 3,
},
}),
BullModule.registerQueue({
name: 'sync-rest',
}),
RedisService,
],
exports: [BullModule, ...processors],
controllers: [...controllers],
providers: [
// services
{
provide: SERVICE_INTERFACE.ISYNC_REST_SERVICE,
useClass: SyncRestService,
},
RedisService,
CommonService,
// repositories
{
provide: REPOSITORY_INTERFACE.IAURA_TX_REPOSITORY,
useClass: AuraTxRepository,
},
{
provide: REPOSITORY_INTERFACE.ISAFE_REPOSITORY,
useClass: SafeRepository,
},
{
provide: REPOSITORY_INTERFACE.ICHAIN_REPOSITORY,
useClass: ChainRepository,
},
{
provide: REPOSITORY_INTERFACE.IMULTISIG_TRANSACTION_REPOSITORY,
useClass: MultisigTransactionRepository,
},
{
provide: REPOSITORY_INTERFACE.IMESSAGE_REPOSITORY,
useClass: MessageRepository,
},
{
provide: REPOSITORY_INTERFACE.ITX_HISTORY_REPOSITORY,
useClass: TransactionHistoryRepository,
},
// processors
...processors,
],
})
export class AppModule {}
13 changes: 0 additions & 13 deletions src/controllers/websocket.controller.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/module.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const ENTITIES_CONFIG = {
};

export const SERVICE_INTERFACE = {
ISYNC_WEBSOCKET_SERVICE: 'ISyncWebsocketService',
ISYNC_REST_SERVICE: 'ISyncRestService',
};

Expand Down
Loading

0 comments on commit 1b6617e

Please sign in to comment.