mirror of
https://github.com/mjrode/WhatToWatch.git
synced 2026-01-05 13:09:29 -06:00
Remvove null values from showData response
This commit is contained in:
@@ -13,18 +13,7 @@ const similarMedia = async (req, res) => {
|
||||
media,
|
||||
);
|
||||
console.log('tdaw response test--', response);
|
||||
|
||||
const jsonLibrary = await models.PlexLibrary.findAll({
|
||||
userId: req.user.id,
|
||||
type: 'show',
|
||||
});
|
||||
// Use Sonarr list instead
|
||||
const libraryTitles = jsonLibrary.map(show => show.title.toLowerCase());
|
||||
const filteredResponse = response.filter(
|
||||
show => !libraryTitles.includes(show.name.toLowerCase()),
|
||||
);
|
||||
console.log('final----response', filteredResponse);
|
||||
res.json(filteredResponse);
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
helpers.handleError(res, tdawApi.name);
|
||||
}
|
||||
|
||||
@@ -49,9 +49,11 @@ const similarMedia = async function(req, mediaName, mediaType) {
|
||||
};
|
||||
|
||||
const getShowData = async filteredResponse => {
|
||||
return await Promise.all(
|
||||
const showData = await Promise.all(
|
||||
filteredResponse.map(show => movieDbApi.searchTv(show.Name)),
|
||||
);
|
||||
console.log('mapped show data', showData);
|
||||
return showData.filter(obj => obj);
|
||||
};
|
||||
|
||||
const qlooMediaId = async (mediaName, mediaType) => {
|
||||
|
||||
Reference in New Issue
Block a user