Linted all controllers
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user