From a6d00714d69a3c2f8fc923c756019ed0c84ac8fe Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 12:28:21 +0200 Subject: [PATCH] Inputs a query, page and type and will search the bay for the query and return it as a json objec.t --- .../webserver/controllers/pirate/searchTheBay.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/seasoned_api/src/webserver/controllers/pirate/searchTheBay.js b/seasoned_api/src/webserver/controllers/pirate/searchTheBay.js index 6ae9949..6ee8eee 100644 --- a/seasoned_api/src/webserver/controllers/pirate/searchTheBay.js +++ b/seasoned_api/src/webserver/controllers/pirate/searchTheBay.js @@ -2,11 +2,11 @@ * @Author: KevinMidboe * @Date: 2017-10-21 09:54:31 * @Last Modified by: KevinMidboe -* @Last Modified time: 2017-10-21 09:58:00 +* @Last Modified time: 2017-10-21 12:12:26 */ const PirateRepository = require('src/pirate/pirateRepository'); -const pirateRepository = new PirateRepository(); +// const pirateRepository = new PirateRepository(); /** * Controller: Retrieves search history of a logged in user @@ -15,12 +15,11 @@ const pirateRepository = new PirateRepository(); * @returns {Callback} */ function updateRequested(req, res) { - const id = req.params.requestName; - const type = req.body.type; + const { query, page, type } = req.query; - pirateRepository.search(id, type) - .then(() => { - res.send({ success: true }); + PirateRepository.SearchPiratebay(query, page, type) + .then((result) => { + res.send({ success: true, torrents: result }); }) .catch((error) => { res.status(401).send({ success: false, error: error.message });