/**
* @module flitter-agenda/templates/Job
*/
/**
* Returns the contents of the Job template.
*
* @param {string} name - the name of the Job class to be generated
*/
module.exports = exports = function JobTemplateGenerator(name){
return `const Job = require('flitter-agenda/Job')
/*
* ${name}Job Definition
* -------------------------------------------------------------
* Put some description here!
*/
class ${name}Job extends Job {
/*
* Job classes are injectable, so you can override the
* static services getter here.
*/
static get services() {
return [...super.services, /* other services here */]
}
/*
* Executed when the job is run.
* Passed an instance of agenda/job and the function to call upon completion.
* See the agenda package docs for more info.
*/
exec(job, done){
/*
* Do stuff here!
*/
/*
* Whatever you do, it should end by calling this function.
* It may be passed as a callback to another function.
*/
done()
}
}
module.exports = exports = ${name}Job`
}