import { SyncedCron } from 'meteor/percolate:synced-cron';
import { sendReports } from '../../api/email/server/reports.js';
import EndOfMonthEnum from '../../api/settings/EndOfMonthEnum';

SyncedCron.add({
  name: 'Send reports for users with end of month on last day',
  schedule(parser) {
    return parser.recur()
      .on(1)
      .dayOfMonth()
      .on(5)
      .hour();
  },
  job() {
    sendReports(undefined, EndOfMonthEnum.LAST_DAY);
  },
});

SyncedCron.add({
  name: 'Send reports for users with end of month on day 20',
  schedule(parser) {
    return parser.recur()
      .on(21)
      .dayOfMonth()
      .on(5)
      .hour();
  },
  job() {
    sendReports(undefined, EndOfMonthEnum.DAY_20);
  },
});

SyncedCron.start();

import { SyncedCron } from 'meteor/percolate:synced-cron';
import { sendReports } from '../../api/email/server/reports.js';
import EndOfMonthEnum from '../../api/settings/EndOfMonthEnum';

SyncedCron.add({
  name: 'Send reports for users with end of month on last day',
  schedule(parser) {
    return parser.recur()
      .on(1)
      .dayOfMonth()
      .on(11)
      .hour();
  },
  job() {
    sendReports(undefined, EndOfMonthEnum.LAST_DAY);
  },
});

SyncedCron.add({
  name: 'Send reports for users with end of month on day 20',
  schedule(parser) {
    return parser.recur()
      .on(21)
      .dayOfMonth()
      .on(11)
      .hour();
  },
  job() {
    sendReports(undefined, EndOfMonthEnum.DAY_20);
  },
});

SyncedCron.start();

Change sendReports time to 11am
Change sendReports time to 11am

Signed-off-by: Felipe Milani <6def120dcec8fcb28aed4723fac713cfff66d853@gmail.com>
