mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix chat estracture
This commit is contained in:
@@ -42,7 +42,8 @@ export class MessageRepositoryService {
|
||||
|
||||
data['requestId'] = InstanceId +'@'+ uuidv4();
|
||||
|
||||
const localActionResult = await this.messageLocalDataSourceService.sendMessage(data)
|
||||
const localActionResult = await this.messageLocalDataSourceService.sendMessage({...data})
|
||||
console.log('create message', data)
|
||||
|
||||
// this.messageLiveDataSourceService.sendMessage({
|
||||
// type: 'sendMessage',
|
||||
@@ -63,17 +64,20 @@ 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
|
||||
// }
|
||||
|
||||
return this.messageLocalDataSourceService.update({...clone, sending: false})
|
||||
// console.log({clone})
|
||||
console.log('update message')
|
||||
//return this.messageLocalDataSourceService.update({...clone, sending: false})
|
||||
return ok(true)
|
||||
}
|
||||
|
||||
} else {
|
||||
return this.messageLocalDataSourceService.update({sending: false})
|
||||
// return this.messageLocalDataSourceService.update({sending: false})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +86,7 @@ export class MessageRepositoryService {
|
||||
if(result.isOk()) {
|
||||
if(result.value) {
|
||||
|
||||
return await this.messageLiveSignalRDataSourceService.sendReadAt({roomId, memberId: SessionStore.user.UserId, chatMessageId: result.value.messageId})
|
||||
// return await this.messageLiveSignalRDataSourceService.sendReadAt({roomId, memberId: SessionStore.user.UserId, chatMessageId: result.value.messageId})
|
||||
}
|
||||
return ok(true)
|
||||
}
|
||||
@@ -116,6 +120,14 @@ export class MessageRepositoryService {
|
||||
}
|
||||
|
||||
sendTyping(roomId) {
|
||||
return this.messageLiveSignalRDataSourceService.sendTyping({roomId, UserName:SessionStore.user.FullName})
|
||||
return this.messageLiveSignalRDataSourceService.sendTyping({
|
||||
roomId,
|
||||
UserName:SessionStore.user.FullName,
|
||||
userId: SessionStore.user.UserId
|
||||
})
|
||||
}
|
||||
|
||||
getMemberByLive({roomId, userId}) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ export class RoomRepositoryService {
|
||||
// },
|
||||
// }
|
||||
|
||||
this.roomLocalDataSourceService.createRoom(roomData)
|
||||
this.roomLocalDataSourceService.createRoom(roomData.chatRoom)
|
||||
}
|
||||
|
||||
for( const roomData of roomsToUpdate) {
|
||||
@@ -78,7 +78,7 @@ export class RoomRepositoryService {
|
||||
// },
|
||||
// }
|
||||
|
||||
this.roomLocalDataSourceService.updateRoom(roomData)
|
||||
this.roomLocalDataSourceService.updateRoom(roomData.chatRoom)
|
||||
}
|
||||
|
||||
for( const roomData of roomsToDelete) {
|
||||
@@ -105,15 +105,15 @@ export class RoomRepositoryService {
|
||||
|
||||
if(result.isOk()) {
|
||||
const localList = await this.roomLocalDataSourceService.getRoomList()
|
||||
const { roomsToDelete, roomsToInsert, roomsToUpdate } = roomListDetermineChanges([result.value.data], localList)
|
||||
// const { roomsToDelete, roomsToInsert, roomsToUpdate } = roomListDetermineChanges([result.value.data], localList)
|
||||
|
||||
for( const roomData of roomsToUpdate) {
|
||||
if(!roomData.createdBy?.wxUserId) {
|
||||
delete roomData.createdBy;
|
||||
}
|
||||
// for( const roomData of roomsToUpdate) {
|
||||
// if(!roomData.chatRoom.createdBy?.wxUserId) {
|
||||
// delete roomData.chatRoom.createdBy;
|
||||
// }
|
||||
|
||||
this.roomLocalDataSourceService.updateRoom(roomData)
|
||||
}
|
||||
// this.roomLocalDataSourceService.updateRoom(roomData.chatRoom)
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -127,10 +127,13 @@ export class RoomRepositoryService {
|
||||
if(result.isOk()) {
|
||||
|
||||
const localListRoom = await this.roomLocalDataSourceService.getRoomList()
|
||||
const { roomsToDelete, roomsToInsert, roomsToUpdate } = roomListDetermineChanges([result.value.data], localListRoom)
|
||||
const object = {
|
||||
chatRoom: result.value.data
|
||||
}
|
||||
const { roomsToDelete, roomsToInsert, roomsToUpdate } = roomListDetermineChanges([object], localListRoom)
|
||||
|
||||
for( const roomData of roomsToUpdate) {
|
||||
this.roomLocalDataSourceService.updateRoom(roomData)
|
||||
this.roomLocalDataSourceService.updateRoom(roomData.chatRoom)
|
||||
}
|
||||
|
||||
// ============================
|
||||
|
||||
Reference in New Issue
Block a user