Fix: Linter warnings (#137)
* Automaticly fixable eslint issues, mostly 3 -> 2 space indentation * fix: updated plex_userid to camelcase * Linted and some consistency refactor on middleware * eslint uses ecmaversion 2020 & allow empty catch rule * Started linting source files * Fixed eslint errors & improved a lot of error handling * Set 2 eslint rules as warning temporarly
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const SearchHistory = require("../../../searchHistory/searchHistory");
|
||||
const configuration = require("../../../config/configuration").getInstance();
|
||||
const TMDB = require("../../../tmdb/tmdb");
|
||||
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
const searchHistory = new SearchHistory();
|
||||
|
||||
@@ -13,7 +14,7 @@ const searchHistory = new SearchHistory();
|
||||
function showSearchController(req, res) {
|
||||
const { query, page, adult } = req.query;
|
||||
const username = req.loggedInUser ? req.loggedInUser.username : null;
|
||||
const includeAdult = adult == "true" ? true : false;
|
||||
const includeAdult = adult === "true";
|
||||
|
||||
if (username) {
|
||||
searchHistory.create(username, query);
|
||||
@@ -25,7 +26,12 @@ function showSearchController(req, res) {
|
||||
res.send(shows);
|
||||
})
|
||||
.catch(error => {
|
||||
res.status(500).send({ success: false, message: error.message });
|
||||
res.status(error?.statusCode || 500).send({
|
||||
success: false,
|
||||
message:
|
||||
error?.message ||
|
||||
`An unexpected error occured while searching person with query: ${query}`
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user