fix duplicate message

This commit is contained in:
Peter Maquiran
2024-08-01 16:38:08 +01:00
parent 82e4acbe87
commit 8774cef0b2
3 changed files with 52 additions and 18 deletions
@@ -65,16 +65,18 @@ export class MessageRepositoryService {
delete sendMessageResult.value.sender
}
// let clone: TableMessage = {
// ...sendMessageResult.value,
// messageId: sendMessageResult.value.id,
// id : localActionResult.value
// }
let clone: TableMessage = {
...sendMessageResult.value,
messageId: sendMessageResult.value.id,
id : localActionResult.value
}
// console.log({clone})
console.log('update message')
//return this.messageLocalDataSourceService.update({...clone, sending: false})
return this.messageLocalDataSourceService.update({...clone, sending: false})
return ok(true)
} else {
console.log('no message to upload')
}
} else {
@@ -84,7 +86,7 @@ export class MessageRepositoryService {
sendMessageDelete(data: MessageDeleteInputDTO) {
data['requestId'] = InstanceId +'@'+ uuidv4();
return this.messageLiveSignalRDataSourceService.sendMessageDelete(data)
@@ -94,7 +96,7 @@ export class MessageRepositoryService {
const result = await this.messageLocalDataSourceService.getLastMessageByRoomId(roomId)
if(result.isOk()) {
if(result.value) {
return await this.messageLiveSignalRDataSourceService.sendReadAt({roomId, memberId: SessionStore.user.UserId, chatMessageId: result.value.messageId})
}
return ok(true)
@@ -130,7 +132,7 @@ export class MessageRepositoryService {
sendTyping(roomId) {
return this.messageLiveSignalRDataSourceService.sendTyping({
roomId,
roomId,
UserName:SessionStore.user.FullName,
userId: SessionStore.user.UserId
})