Hello, I have a task to send daily mails with some information. Information need to be taken from DB but
I receive errors like in terminal, UserService is undefined.
#How to allow access to DB in service for daily mail sender function with @Cron || @Interval
7 messages · Page 1 of 1 (latest)
you're missing the @Injectable decorator over DailyMailService, so Nest doesn't see any metadata about what to inject.
Next error when I add @Injectable. Where I need to add this UserService. I have it in dailyMail.module.ts (second picture)
Do not put services in multiple providers array in multiple modules. Nest will try to create a new instance every time you do. Instead export the providers and import the module which exports the provider in the module where it is needed.
So right now I remove dailyModule and I put dailyService in in ServiceModule and I create my method in UsersService to be with @Inteval(100) for testing but right now i receive warning.WARN [Scheduler] Cannot register interval "UserService@TestMailSender" because it is defined in a non static provider. How i can fix this. I try to found something in WEB but .. :/
Nonstatic provider means it is transitively request-scoped
Ok but how I can fix it ;/