You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.5 KiB
51 lines
1.5 KiB
const {query} = require("../client")
|
|
|
|
class Comment {
|
|
/**
|
|
* @param {string} id
|
|
* @param {string} subject
|
|
* @param {string} author
|
|
* @param {string} characterName
|
|
* @param {CommentCharacter} character
|
|
* @param {string | number | Date} fictionalDate
|
|
* @param {string | number | Date} createdDate
|
|
* @param {string | number | Date} editedDate
|
|
* @param {string} source
|
|
*/
|
|
constructor(id, subject, author, characterName, character, fictionalDate, createdDate, editedDate, source) {
|
|
this.id = id
|
|
this.subject = subject
|
|
this.author = author
|
|
this.characterName = characterName
|
|
this.character = CommentCharacter.fromData(character)
|
|
this.fictionalDate = new Date(fictionalDate)
|
|
this.createdDate = new Date(createdDate)
|
|
this.editedDate = new Date(editedDate)
|
|
this.source = source
|
|
}
|
|
|
|
static fromData(data) {
|
|
return new Comment(data.id, data.subject, data.author, data.characterName, data.character, data.fictionalDate, data.createdDate, data.editedDate, data.source)
|
|
}
|
|
}
|
|
|
|
class CommentCharacter {
|
|
/**
|
|
* @param {string} id
|
|
* @param {string} name
|
|
* @param {string} author
|
|
* @param {string} description
|
|
*/
|
|
constructor(id, name, author, description) {
|
|
this.id = id
|
|
this.name = name
|
|
this.author = author
|
|
this.description = description
|
|
}
|
|
|
|
static fromData(data) {
|
|
return new CommentCharacter(data.id, data.name, data.author, data.description)
|
|
}
|
|
}
|
|
|
|
module.exports = {Comment, CommentCharacter}
|