Я пытаюсь выяснить, почему я получаю следующую ошибку:
Nest не может разрешить зависимости от UniqueInteractionsService (?). Убедитесь, что зависимость аргумента в индексе [0] доступна в контексте SharedModule.
мои классы:
sharedModule.ts:
import {Module, Global} from '@nestjs/common';
import {InteractionsService} from "./elasticsearch/interactionsService";
import {UniqueInteractionsService} from "./elasticsearch/uniqueInteractionsService";
import {EsProvider} from "./elasticsearch/esProvider";
@Global()
@Module({
exports: [InteractionsService, UniqueInteractionsService],
providers: [EsProvider, InteractionsService, UniqueInteractionsService]
})
export class SharedModule {
}
interacionsService.ts:
import {ESService} from "./ESService";
import {Injectable, Inject} from '@nestjs/common';
@Injectable()
export class InteractionsService{
constructor(@Inject(ESService) private readonly esService: ESService) {}
// more stuff
}
uniqueInteractionsService.ts:
import {ESService} from "./ESService";
import {Injectable, Inject} from '@nestjs/common';
@Injectable()
export class UniqueInteractionsService{
constructor(@Inject(ESService) private readonly esService: ESService) {}
// more stuff
}
esProvider.ts:
import {ESService} from "./esService";
export const EsProvider = {
provide: ESService,
useFactory: async () => {
const esService = new ESService();
await esService.init();
return esService;
}
};