mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-21 09:05:17 +00:00
Can open new conversations
This commit is contained in:
42
src/entities/ConversationMessage.ts
Normal file
42
src/entities/ConversationMessage.ts
Normal file
@ -0,0 +1,42 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user