From 4d853565d10745e05b2bb05da1c07ac04cec25c7 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sun, 6 Mar 2022 11:50:20 +0100 Subject: [PATCH] Person gets biography & place_of_birth attributes --- seasoned_api/src/tmdb/types/person.js | 51 ++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/seasoned_api/src/tmdb/types/person.js b/seasoned_api/src/tmdb/types/person.js index 798dff9..67ca569 100644 --- a/seasoned_api/src/tmdb/types/person.js +++ b/seasoned_api/src/tmdb/types/person.js @@ -1,23 +1,54 @@ -class Person { - constructor(id, name, poster=undefined, birthday=undefined, deathday=undefined, - adult=undefined, knownForDepartment=undefined) { +class Person { + constructor( + id, + name, + poster = undefined, + birthday = undefined, + deathday = undefined, + adult = undefined, + placeOfBirth = undefined, + biography = undefined, + knownForDepartment = undefined + ) { this.id = id; this.name = name; this.poster = poster; this.birthday = birthday; this.deathday = deathday; this.adult = adult; + this.placeOfBirth = placeOfBirth; + this.biography = biography; this.knownForDepartment = knownForDepartment; - this.type = 'person'; + this.type = "person"; } static convertFromTmdbResponse(response) { - const { id, name, profile_path, birthday, deathday, adult, known_for_department } = response; + const { + id, + name, + profile_path, + birthday, + deathday, + adult, + place_of_birth, + biography, + known_for_department + } = response; - const birthDay = new Date(birthday) - const deathDay = deathday ? new Date(deathday) : null + const birthDay = new Date(birthday); + const deathDay = deathday ? new Date(deathday) : null; - return new Person(id, name, profile_path, birthDay, deathDay, adult, known_for_department) + return new Person( + id, + name, + profile_path, + birthDay, + deathDay, + adult, + place_of_birth, + biography, + known_for_department + ); } createJsonResponse() { @@ -27,10 +58,12 @@ class Person { poster: this.poster, birthday: this.birthday, deathday: this.deathday, + place_of_birth: this.placeOfBirth, + biography: this.biography, known_for_department: this.knownForDepartment, adult: this.adult, type: this.type - } + }; } }