fix: people details page not working for people that are not in db

This commit is contained in:
Mohammed Abad committed 2026-04-27 12:33:02 +01:00
1 parent 0329808562
commit 8aca121b10
5 files changed
+317 -20

No files matched your search

+24
View File
@@ -105,6 +105,30 @@ class PeopleController {
if (!data) return res.status(500).json({ message: 'Failed to search TMDB people' });
res.status(200).json(data);
}
async getTmdbPersonPreview(req, res) {
const { tmdbId } = req.params;
const personData = await tmdbService.fetchPersonDetails(tmdbId);
if (!personData) return res.status(404).json({ message: 'Person not found on TMDB' });
const filmography = await tmdbService.fetchPersonCombinedCredits(tmdbId);
const preview = {
tmdb_id: personData.id,
name: personData.name,
biography: personData.biography || null,
birthday: personData.birthday || null,
deathday: personData.deathday || null,
place_of_birth: personData.place_of_birth || null,
profile_path: personData.profile_path || null,
known_for_department: personData.known_for_department || null,
popularity: personData.popularity || null,
imdb_id: personData.imdb_id || personData.external_ids?.imdb_id || null,
filmography: filmography || { cast: [], crew: [] },
};
res.status(200).json(preview);
}
}
module.exports = new PeopleController();