send direct message

This commit is contained in:
Peter Maquiran
2024-08-20 16:34:47 +01:00
parent 4fb24f7875
commit 59fc19879f
41 changed files with 912 additions and 308 deletions
+76
View File
@@ -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
}
}