1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 07:19:23 +00:00
comunicapiv2/src/entities/ConversationMessage.ts

42 lines
857 B
TypeScript
Raw Normal View History

2019-11-30 14:17:47 +00:00
import { pathUserData } from "../utils/UserDataUtils";
/**
* Single conversation message
*
* @author Pierre HUBERT
*/
export interface ConversationMessageInfo {
id: number,
convID: number,
userID: number,
timeSent: number,
imagePath: string,
message: string
}
export class ConversationMessage implements ConversationMessageInfo {
public id: number;
public convID: number;
public userID: number;
public timeSent: number;
public imagePath: string;
public message: string;
constructor(info: ConversationMessageInfo) {
this.id = info.id;
this.convID = info.convID;
this.userID = info.userID;
this.timeSent = info.timeSent;
this.imagePath = info.imagePath;
this.message = info.message;
}
get hasImage() : boolean {
return this.imagePath.length > 1;
}
get imageURL() : string {
return pathUserData(this.imagePath);
}
}