src/helpers/discuss/Comment.js
import Helper from '../Helper';
import CommentModel from '../../models/discuss/Comment';
import { aggregate } from '../../utilities/ClassUtility';
/**
* Helper class representing a Comment.
*/
class Comment extends aggregate(CommentModel, Helper) {
/**
* Constructor for helper class representing Comment
*
* @param {Object} json - json api response from server
*/
constructor(json = {}) {
super(json);
this.deserializeRelationshipStubs(json);
this.syncRelationships(json);
}
/** @type {String} - The type */
static get type() {
return 'commentable__comments';
}
/** @type {Thread} */
get thread() {
return this._relationships.thread;
}
/** @type {Thread} */
set thread(thread) {
/** @type {Thread} */
this._relationships.thread = thread;
}
/** @type {User} */
get author() {
return this._relationships.author;
}
/** @type {User} */
set author(author) {
/** @type {User} */
this._relationships.author = author;
}
}
export default Comment;