mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
send direct message
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
import { SafeResourceUrl } from "@angular/platform-browser";
|
||||
import { MessageAttachmentFileType, MessageAttachmentSource } from "src/app/module/chat/data/dto/message/messageOutputDTO";
|
||||
import { MessageEntity } from "src/app/module/chat/domain/entity/message";
|
||||
|
||||
export class MessageViewModal {
|
||||
$id: number
|
||||
id: string
|
||||
roomId?: string
|
||||
receiverId?: number
|
||||
message: string
|
||||
messageType: number = 0
|
||||
canEdit: boolean = false
|
||||
oneShot: boolean = false
|
||||
sentAt: string
|
||||
requireUnlock: boolean = false
|
||||
info: {
|
||||
memberId?: number
|
||||
readAt?: string,
|
||||
deliverAt?: string
|
||||
}[] = []
|
||||
sender: {
|
||||
wxUserId: number,
|
||||
wxFullName: string,
|
||||
wxeMail: string,
|
||||
userPhoto: string,
|
||||
}
|
||||
sending: boolean = false
|
||||
sendAttemp = 0
|
||||
|
||||
attachments: {
|
||||
safeFile?: SafeResourceUrl;
|
||||
fileType: MessageAttachmentFileType,
|
||||
source: MessageAttachmentSource,
|
||||
file?: string,
|
||||
fileName: string,
|
||||
applicationId?: number,
|
||||
docId?: string,
|
||||
mimeType?: string,
|
||||
description?: string
|
||||
id?: string
|
||||
}[] = []
|
||||
|
||||
reactions = []
|
||||
requestId: string
|
||||
status = ''
|
||||
|
||||
constructor(model: MessageEntity) {
|
||||
Object.assign(this, model)
|
||||
}
|
||||
|
||||
|
||||
messageStatus(totalMembers: number) {
|
||||
if(this.allViewed(totalMembers)) {
|
||||
this.status = 'allViewed'
|
||||
} else if(this.allReceived(totalMembers)) {
|
||||
this.status = 'allReceived'
|
||||
} else if (this.id) {
|
||||
this.status = 'enviado'
|
||||
} else {
|
||||
this.status = 'enviar'
|
||||
}
|
||||
}
|
||||
|
||||
allReceived(totalMembers: number) {
|
||||
return this.info.filter(e => typeof e.deliverAt == 'string').length == totalMembers
|
||||
}
|
||||
|
||||
allViewed(totalMembers: number) {
|
||||
return this.info.filter(e => typeof e.readAt == 'string').length == totalMembers
|
||||
}
|
||||
|
||||
get hasAttachment() {
|
||||
return this.attachments.length >= 1
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user