Linted all controllers

This commit is contained in:
2018-02-07 13:51:57 +01:00
parent 81aeed86ef
commit 34982c14fe
20 changed files with 195 additions and 186 deletions

View File

@@ -1,6 +1,7 @@
const configuration = require('src/config/configuration').getInstance();
const Cache = require('src/tmdb/cache');
const TMDB = require('src/tmdb/tmdb');
const cache = new Cache();
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
@@ -11,20 +12,20 @@ const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
* @returns {Callback}
*/
function searchMediaController(req, res) {
const { query, page, type } = req.query;
const { query, page, type } = req.query;
Promise.resolve()
.then(() => tmdb.search(query, page, type))
.then((movies) => {
if (movies !== undefined || movies.length > 0) {
res.send(movies);
} else {
res.status(404).send({ success: false, error: 'Search query did not return any results.'})
}
})
.catch((error) => {
res.status(500).send({ success: false, error: error.message });
});
Promise.resolve()
.then(() => tmdb.search(query, page, type))
.then((movies) => {
if (movies !== undefined || movies.length > 0) {
res.send(movies);
} else {
res.status(404).send({ success: false, error: 'Search query did not return any results.' });
}
})
.catch((error) => {
res.status(500).send({ success: false, error: error.message });
});
}
module.exports = searchMediaController;