1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-21 00:55:17 +00:00

Get & return the comments of a post

This commit is contained in:
2020-01-03 17:31:39 +01:00
parent 5a45096fa6
commit 2924b205fd
4 changed files with 136 additions and 1 deletions

39
src/entities/Comment.ts Normal file
View File

@ -0,0 +1,39 @@
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);
}
}