-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Evyweb/feature/use-ioctopus-modules
Feature/use ioctopus modules feature
- Loading branch information
Showing
8 changed files
with
71 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import { Container } from '@evyweb/ioctopus'; | ||
import { createModule } from '@evyweb/ioctopus'; | ||
|
||
import { TransactionManagerService } from '@/src/infrastructure/services/transaction-manager.service'; | ||
import { MockTransactionManagerService } from '@/src/infrastructure/services/transaction-manager.service.mock'; | ||
|
||
import { DI_SYMBOLS } from '@/di/types'; | ||
|
||
export function registerTransactionManagerModule(container: Container) { | ||
export function createTransactionManagerModule() { | ||
const transactionManagerModule = createModule(); | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
container | ||
transactionManagerModule | ||
.bind(DI_SYMBOLS.ITransactionManagerService) | ||
.toClass(MockTransactionManagerService); | ||
} else { | ||
container | ||
transactionManagerModule | ||
.bind(DI_SYMBOLS.ITransactionManagerService) | ||
.toClass(TransactionManagerService); | ||
} | ||
|
||
return transactionManagerModule; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import { Container } from '@evyweb/ioctopus'; | ||
import { createModule } from '@evyweb/ioctopus'; | ||
|
||
import { MockUsersRepository } from '@/src/infrastructure/repositories/users.repository.mock'; | ||
import { UsersRepository } from '@/src/infrastructure/repositories/users.repository'; | ||
|
||
import { DI_SYMBOLS } from '@/di/types'; | ||
|
||
export function registerUsersModule(container: Container) { | ||
export function createUsersModule() { | ||
const usersModule = createModule(); | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
container.bind(DI_SYMBOLS.IUsersRepository).toClass(MockUsersRepository); | ||
usersModule.bind(DI_SYMBOLS.IUsersRepository).toClass(MockUsersRepository); | ||
} else { | ||
container | ||
usersModule | ||
.bind(DI_SYMBOLS.IUsersRepository) | ||
.toClass(UsersRepository, [ | ||
DI_SYMBOLS.IInstrumentationService, | ||
DI_SYMBOLS.ICrashReporterService, | ||
]); | ||
} | ||
|
||
return usersModule; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters