all files / src/user/ jobs.js

23.08% Statements 3/13
100% Branches 0/0
20% Functions 1/5
23.08% Lines 3/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                                     
 
'use strict';
 
var winston = require('winston'),
	cronJob = require('cron').CronJob,
 
	meta = require('../meta');
 
module.exports = function(User) {
	User.startJobs = function() {
		new cronJob('0 0 17 * * *', function() {
			winston.verbose('[user.startJobs] Digest job (daily) started.');
			User.digest.execute('day');
		}, null, true);
 
		new cronJob('0 0 17 * * 0', function() {
			winston.verbose('[user.startJobs] Digest job (weekly) started.');
			User.digest.execute('week');
		}, null, true);
 
		new cronJob('0 0 17 1 * *', function() {
			winston.verbose('[user.startJobs] Digest job (monthly) started.');
			User.digest.execute('month');
		}, null, true);
 
		new cronJob('0 0 0 * * *', User.reset.clean, null, true);
	};
};