2022-07-21 21:39:54 +03: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;
|
|
|
|
}
|
2022-07-22 18:43:08 +03:00
|
|
|
|
|
|
|
async update(id, data) {
|
|
|
|
await this._JobModel.edit(data, {id});
|
|
|
|
}
|
2022-07-21 21:39:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = JobsRepository;
|