Ghost/ghost/job-manager/lib/jobs-repository.js
Naz 5dae6d6acf Added support for one off jobs
refs https://github.com/TryGhost/Toolbox/issues/357

- This is a scaffolding for what will become a one off job scheduling mechanism. The aim is allowing to run jobs which can be only ever be run once in the lifetime of the instance - persisting through restarts.
2022-07-21 19:39:54 +01:00

20 lines
341 B
JavaScript

class JobsRepository {
constructor({JobModel}) {
this._JobModel = JobModel;
}
async add(data) {
const job = await this._JobModel.add(data);
return job;
}
async read(name) {
const job = await this._JobModel.findOne({name});
return job;
}
}
module.exports = JobsRepository;