All converter function from tmdb to movie, show and person takes optional cast object and maps to response

This commit is contained in:
2019-06-04 23:35:21 +02:00
parent 99bab3fb73
commit 70f6497404
3 changed files with 15 additions and 3 deletions

View File

@@ -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);
}