Person gets biography & place_of_birth attributes

This commit is contained in:
2022-03-06 11:50:20 +01:00
parent 91c81e5cf6
commit 4d853565d1

View File

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