Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Violated the Dependency Rule of Clean Architecture #6

Open
wenlong-chen opened this issue Oct 15, 2024 · 3 comments
Open

Violated the Dependency Rule of Clean Architecture #6

wenlong-chen opened this issue Oct 15, 2024 · 3 comments

Comments

@wenlong-chen
Copy link

import { UserRepository } from '@infrastructure/repository/user.repository';

Domain should not depends on infrastructure.

@Bezlepkin
Copy link

import { UserRepository } from '@infrastructure/repository/user.repository';

Domain should not depends on infrastructure.

Because it's not a dependency inversion, it's a dependency injection.

This is the very reason why I don't like NestJs :)

@KR1470R
Copy link

KR1470R commented Dec 15, 2024

import { UserRepository } from '@infrastructure/repository/user.repository';

Domain should not depends on infrastructure.

Because it's not a dependency inversion, it's a dependency injection.

This is the very reason why I don't like NestJs :)

@Bezlepkin, for dependency inversion, in nestjs, you should inject provider via:
@Inject(EXAMPLE_USERS_REPOSITORY) usersRepository: IUsersRepository
and in the module just import:

{
   providers: [
       {
           provide: EXAMPLE_USERS_REPOSITORY,
           useClass: UsersRepository
       }
   ]
}

@ToxicToast
Copy link

This is the very reason why I don't like NestJs :)

You can write Clean Code in NestJS too but the Repo Owner did not understand DDD yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants