Jobserve and s1Jobs rss scraper added

This commit is contained in:
Martin Donnelly 2020-05-26 09:31:51 +01:00
parent 538275cb37
commit 581989c9b4
7 changed files with 41 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -97,4 +97,19 @@ exports.appliedOne = (data) => {
});
};
exports.markAllRead = () => {
const sql = 'insert into read (rid, d) select jobs._id as rid, strftime(\'%s\',\'now\') as d from jobs left join read on read.rid = jobs._id where read.d is null order by jobs._id desc;';
return new Promise((resolve, reject) => {
db.run(sql, [], function(err) {
if (err && err.errno !== 19) {
console.log(err);
reject(err);
}
resolve({});
});
});
};
// select _id, title, site, company, timestamp from jobs order by _id desc;

View File

@ -32,3 +32,19 @@ exports.markApplied = (req, res) => {
});
});
};
exports.markAllRead = (req, res) => {
console.log('>markAllRead req', req.params);
dbmanager.markAllRead()
.then((data) => {
console.log(data);
res.status(200).end();
})
.catch((err) => {
res.status(500).send({
'message': err.message || 'Some error occurred while querying the database.'
});
});
};

View File

@ -11,4 +11,7 @@ const apply = require('../controllers/apply.controller');
module.exports = (app) => {
app.route('/apply/:id')
.put(apply.markApplied);
app.route('/readall')
.put(apply.markAllRead);
};