Skip to content

Commit

Permalink
Pass repositories as object
Browse files Browse the repository at this point in the history
  • Loading branch information
tokland committed Sep 17, 2024
1 parent 33fc8b4 commit dde93af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CompositionRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Repositories = {
function getCompositionRoot(repositories: Repositories) {
return {
users: {
getCurrent: new GetCurrentUserUseCase(repositories.usersRepository),
getCurrent: new GetCurrentUserUseCase(repositories),
},
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/domain/usecases/GetCurrentUserUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { User } from "$/domain/entities/User";
import { UserRepository } from "$/domain/repositories/UserRepository";

export class GetCurrentUserUseCase {
constructor(private usersRepository: UserRepository) {}
constructor(private options: { usersRepository: UserRepository }) {}

public execute(): FutureData<User> {
return this.usersRepository.getCurrent();
return this.options.usersRepository.getCurrent();
}
}

0 comments on commit dde93af

Please sign in to comment.