jobscraper/server/controllers/apply.controller.js
2020-05-26 09:31:51 +01:00

51 lines
1.0 KiB
JavaScript

/**
* Created by WebStorm.
* User: martin
* Date: 25/05/2020
* Time: 13:36
*/
const dbmanager = require('../../lib/dbmanager');
exports.markApplied = (req, res) => {
console.log('>markApplied req', req.params);
if(!req.params.id)
return res.status(500).send({
'message': 'Job id missing'
});
const aid = req.params.id;
const a = new Date().getTime();
// touchOne
dbmanager.appliedOne({ aid, a })
.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.'
});
});
};
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.'
});
});
};