All converter function from tmdb to movie, show and person takes optional cast object and maps to response
This commit is contained in:
@@ -2,11 +2,15 @@ const Movie = require('src/tmdb/types/movie');
|
||||
|
||||
const tmdbSwitcher = (tmdbMovie, property) => tmdbMovie[property]
|
||||
|
||||
function convertTmdbToMovie(tmdbMovie) {
|
||||
function convertTmdbToMovie(tmdbMovie, credits=undefined) {
|
||||
const movie = new Movie(tmdbMovie.id, tmdbMovie.title)
|
||||
movie.overview = tmdbMovie.overview;
|
||||
movie.rank = tmdbMovie.vote_average;
|
||||
|
||||
if (credits) {
|
||||
movie.credits = credits;
|
||||
}
|
||||
|
||||
if (tmdbMovie.release_date !== undefined) {
|
||||
movie.release_date = new Date(tmdbMovie.release_date);
|
||||
movie.year = movie.release_date.getFullYear();
|
||||
|
||||
Reference in New Issue
Block a user