mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-26 07:19:23 +00:00
42 lines
857 B
TypeScript
42 lines
857 B
TypeScript
|
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);
|
||
|
}
|
||
|
}
|