I'm having troubles with Awilix library. I am following the example in the documentation, but when I execute the function, it crash with this message: "AwilixResolutionError: Could not resolve 'run'".
My code is like this:
I have a file with the dependency injection in awilix:
const container = awilix.createContainer({
injectionMode: awilix.InjectionMode.PROXY,
});
container.register({
userRepo: awilix.asClass(UserMock),
getUserById: awilix.asClass(GetUserByIdInteractor),
signin: awilix.asClass(Signin),
});
export const signin: Signin = container.resolve('signin');
The class "Signin":
export class new Signin extends UseCase {
constructor(private getUserById: GetUserById){ super() }
async run(username: string, password: string) {
// some code
}
}
The GetUserById class:
export class new GetUserById {
constructor(private userRepo: UserRepository){ super() }
async run(id: string) {
// some code
}
}
The UserRepository:
export interface UserRepository { getById(id: string): Promise<User> }
The Repository implementation:
export UserMock implements UserRepository {
getById(id: string){
//some code
}
}
Finally I use the signin constant exported in a GQL Resolver:
export class SigninResolver {
async signin(@Arg('data', () => SigninInput){
const res = signin(data.username, data.password);
return res;
}
}
Please, helpme u.u