All converter function from tmdb to movie, show and person takes optional cast object and maps to response
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
const Show = require('src/tmdb/types/show');
|
||||
|
||||
function convertTmdbToShow(tmdbShow) {
|
||||
function convertTmdbToShow(tmdbShow, credits=undefined) {
|
||||
const show = new Show(tmdbShow.id, tmdbShow.name)
|
||||
show.seasons = tmdbShow.number_of_seasons;
|
||||
show.episodes = tmdbShow.number_of_episodes;
|
||||
show.overview = tmdbShow.overview;
|
||||
show.rank = tmdbShow.vote_average;
|
||||
|
||||
if (credits) {
|
||||
show.credits = credits
|
||||
}
|
||||
|
||||
if (tmdbShow.genres !== undefined) {
|
||||
show.genres = tmdbShow.genres.map(genre => genre.name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user