Read and pass adult search query param consistently for movie, show & person info

This commit is contained in:
2022-03-06 11:57:45 +01:00
parent 61b59ae3ea
commit 5036f4ca36
4 changed files with 34 additions and 36 deletions

View File

@@ -11,18 +11,17 @@ const searchHistory = new SearchHistory();
* @returns {Callback}
*/
function personSearchController(req, res) {
const { query, page } = req.query;
const { query, page, adult } = req.query;
const username = req.loggedInUser ? req.loggedInUser.username : null;
const includeAdult = adult == "true" ? true : false;
if (username) {
return searchHistory.create(username, query);
searchHistory.create(username, query);
}
tmdb
.personSearch(query, page)
.then(person => {
res.send(person);
})
return tmdb
.personSearch(query, page, includeAdult)
.then(persons => res.send(persons))
.catch(error => {
const { status, message } = error;