mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-26 07:19:23 +00:00
39 lines
748 B
TypeScript
39 lines
748 B
TypeScript
|
import { pathUserData } from "../utils/UserDataUtils";
|
||
|
|
||
|
/**
|
||
|
* Single comment information
|
||
|
*
|
||
|
* @author Pierre HUBERT
|
||
|
*/
|
||
|
|
||
|
export interface CommentBuilder {
|
||
|
id: number,
|
||
|
timeSent: number,
|
||
|
userID: number,
|
||
|
postID: number,
|
||
|
content: string,
|
||
|
imagePath ?: string,
|
||
|
}
|
||
|
|
||
|
export class Comment implements CommentBuilder {
|
||
|
id: number; timeSent: number;
|
||
|
userID: number;
|
||
|
postID: number;
|
||
|
content: string;
|
||
|
imagePath?: string;
|
||
|
|
||
|
public constructor(info: CommentBuilder) {
|
||
|
for (const key in info) {
|
||
|
if (info.hasOwnProperty(key))
|
||
|
this[key] = info[key];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
get hasImage() : boolean {
|
||
|
return this.imagePath != null && this.imagePath != "" && this.imagePath != "null";
|
||
|
}
|
||
|
|
||
|
get imageURL() : string {
|
||
|
return pathUserData(this.imagePath);
|
||
|
}
|
||
|
}
|