Person gets biography & place_of_birth attributes
This commit is contained in:
@@ -1,23 +1,54 @@
|
|||||||
class Person {
|
class Person {
|
||||||
constructor(id, name, poster=undefined, birthday=undefined, deathday=undefined,
|
constructor(
|
||||||
adult=undefined, knownForDepartment=undefined) {
|
id,
|
||||||
|
name,
|
||||||
|
poster = undefined,
|
||||||
|
birthday = undefined,
|
||||||
|
deathday = undefined,
|
||||||
|
adult = undefined,
|
||||||
|
placeOfBirth = undefined,
|
||||||
|
biography = undefined,
|
||||||
|
knownForDepartment = undefined
|
||||||
|
) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.poster = poster;
|
this.poster = poster;
|
||||||
this.birthday = birthday;
|
this.birthday = birthday;
|
||||||
this.deathday = deathday;
|
this.deathday = deathday;
|
||||||
this.adult = adult;
|
this.adult = adult;
|
||||||
|
this.placeOfBirth = placeOfBirth;
|
||||||
|
this.biography = biography;
|
||||||
this.knownForDepartment = knownForDepartment;
|
this.knownForDepartment = knownForDepartment;
|
||||||
this.type = 'person';
|
this.type = "person";
|
||||||
}
|
}
|
||||||
|
|
||||||
static convertFromTmdbResponse(response) {
|
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 birthDay = new Date(birthday);
|
||||||
const deathDay = deathday ? new Date(deathday) : null
|
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() {
|
createJsonResponse() {
|
||||||
@@ -27,10 +58,12 @@ class Person {
|
|||||||
poster: this.poster,
|
poster: this.poster,
|
||||||
birthday: this.birthday,
|
birthday: this.birthday,
|
||||||
deathday: this.deathday,
|
deathday: this.deathday,
|
||||||
|
place_of_birth: this.placeOfBirth,
|
||||||
|
biography: this.biography,
|
||||||
known_for_department: this.knownForDepartment,
|
known_for_department: this.knownForDepartment,
|
||||||
adult: this.adult,
|
adult: this.adult,
|
||||||
type: this.type
|
type: this.type
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user