2020-02-18 08:57:00 +01:00
|
|
|
import { Actor, IActor } from "@/types/actor";
|
|
|
|
import { EventModel, IEvent } from "@/types/event.model";
|
2019-11-15 18:36:47 +01:00
|
|
|
|
|
|
|
export interface IComment {
|
|
|
|
id?: string;
|
|
|
|
uuid?: string;
|
|
|
|
url?: string;
|
|
|
|
text: string;
|
2019-12-18 18:25:40 +01:00
|
|
|
local: boolean;
|
2019-11-15 18:36:47 +01:00
|
|
|
actor: IActor;
|
|
|
|
inReplyToComment?: IComment;
|
|
|
|
originComment?: IComment;
|
|
|
|
replies: IComment[];
|
|
|
|
event?: IEvent;
|
|
|
|
updatedAt?: Date;
|
|
|
|
deletedAt?: Date;
|
|
|
|
totalReplies: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CommentModel implements IComment {
|
|
|
|
actor: IActor = new Actor();
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
id?: string;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
text = "";
|
|
|
|
|
|
|
|
local = true;
|
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
url?: string;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
uuid?: string;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
inReplyToComment?: IComment = undefined;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
originComment?: IComment = undefined;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
replies: IComment[] = [];
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
event?: IEvent = undefined;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
updatedAt?: Date = undefined;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
deletedAt?: Date = undefined;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
totalReplies = 0;
|
2019-11-15 18:36:47 +01:00
|
|
|
|
|
|
|
constructor(hash?: IComment) {
|
|
|
|
if (!hash) return;
|
|
|
|
|
|
|
|
this.id = hash.id;
|
|
|
|
this.uuid = hash.uuid;
|
|
|
|
this.url = hash.url;
|
|
|
|
this.text = hash.text;
|
|
|
|
this.inReplyToComment = hash.inReplyToComment;
|
|
|
|
this.originComment = hash.originComment;
|
|
|
|
this.actor = new Actor(hash.actor);
|
|
|
|
this.event = new EventModel(hash.event);
|
|
|
|
this.replies = hash.replies;
|
|
|
|
this.updatedAt = hash.updatedAt;
|
|
|
|
this.deletedAt = hash.deletedAt;
|
|
|
|
this.totalReplies = hash.totalReplies;
|
|
|
|
}
|
|
|
|
}
|