Calling function for fetching all the requested items.

This commit is contained in:
2017-09-27 17:55:07 +02:00
parent e43bcbdd52
commit 149b05ef28

View File

@@ -0,0 +1,23 @@
const RequestRepository = require('src/plex/requestRepository.js');
const requestRepository = new RequestRepository();
/**
* Controller: Retrieves search history of a logged in user
* @param {Request} req http request variable
* @param {Response} res
* @returns {Callback}
*/
function historyController(req, res) {
const user = req.loggedInUser;
console.log('here')
requestRepository.fetchRequested()
.then((requestedItems) => {
res.send({ success: true, requestedItems });
})
.catch((error) => {
res.status(401).send({ success: false, error: error.message });
});
}
module.exports = historyController;