2023-09-07 09:39:09 +00:00
|
|
|
import Entity from "./Entity.mjs";
|
2023-09-09 09:32:35 +00:00
|
|
|
import dataValidation from "./dataValidation.mjs";
|
2023-09-07 09:39:09 +00:00
|
|
|
//THIS CLASS WILL HANDLE JUNCTION TABLE STUFF
|
|
|
|
export default class Title extends Entity{
|
2023-09-27 09:44:44 +00:00
|
|
|
#genres
|
2023-09-07 10:07:34 +00:00
|
|
|
set _title(prop){
|
|
|
|
if(prop){
|
2023-09-09 09:32:35 +00:00
|
|
|
if(!dataValidation.isString(prop)){throw new TypeError("title must be a string")}
|
2023-09-07 10:07:34 +00:00
|
|
|
this.title=prop
|
2023-09-07 09:39:09 +00:00
|
|
|
}
|
2023-09-07 10:07:34 +00:00
|
|
|
}
|
|
|
|
set _genres(prop){
|
|
|
|
if(prop){
|
2023-09-27 09:44:44 +00:00
|
|
|
if(!dataValidation.isObject(prop)){throw new TypeError(`genres must be an object; this is a ${typeof prop}`)}
|
|
|
|
this.#genres=prop
|
2023-09-07 09:39:09 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-14 09:40:19 +00:00
|
|
|
set _deleted(prop){
|
|
|
|
if(prop){
|
|
|
|
if(prop===1 || prop===0){
|
|
|
|
this.deleted=prop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-09-27 09:44:44 +00:00
|
|
|
get genres(){
|
|
|
|
return this.#genres
|
|
|
|
}
|
2023-09-07 10:07:34 +00:00
|
|
|
|
|
|
|
constructor(data){
|
|
|
|
super(data)
|
|
|
|
this._title = data?.title
|
|
|
|
this._genres = data?.genres
|
2023-09-14 09:40:19 +00:00
|
|
|
this._deleted = data?.deleted
|
2023-09-07 10:07:34 +00:00
|
|
|
}
|
2023-09-07 09:39:09 +00:00
|
|
|
}
|