rittenhop-dev/versions/5.94.2/node_modules/@tryghost/job-manager/lib/JobsRepository.js

24 lines
424 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
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;
}
async update(id, data) {
await this._JobModel.edit(data, {id});
}
}
module.exports = JobsRepository;