nestjs / schedule

Schedule module for Nest framework (node.js) ⏰

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decorators do not work in controllers

damiankoper opened this issue · comments

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

@Cron and other decorators work only in providers (injectables defined in providers:[]).
Documentation does not mention that decorators do not work in controllers.

Expected behavior

@Cron and other decorators work in controllers. Does it require simple change in schedule.explorer.ts with discoveryService?
If it is not possible, the docs should be explicit about this.

Minimal reproduction of the problem with instructions

  1. Create method with @Cron('* * * * * *') decorator in controller.
  2. It does not work in controllers

What is the motivation / use case for changing the behavior?

I want to define CRON method in controller alongside with manually triggered endpoint.

Environment


Nest version: 7.4.4

For Tooling issues:
- Node version: v12.13.0  
- Platform: Linux  

Fixed in 0.4.1