mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add readAt functionality
This commit is contained in:
@@ -7,6 +7,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { SignalRService } from '../../infra/socket/signal-r.service';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { err, ok } from 'neverthrow';
|
||||
|
||||
export const InstanceId = uuidv4();
|
||||
|
||||
@@ -50,9 +51,6 @@ export class MessageRepositoryService {
|
||||
|
||||
if(localActionResult.isOk()) {
|
||||
|
||||
(await this.sendTyping(data.roomId)).map((e) => {
|
||||
console.log('map', e)
|
||||
})
|
||||
const sendMessageResult = await this.messageLiveSignalRDataSourceService.sendMessage(data)
|
||||
|
||||
|
||||
@@ -79,6 +77,18 @@ export class MessageRepositoryService {
|
||||
}
|
||||
}
|
||||
|
||||
async sendReadAt({roomId}) {
|
||||
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)
|
||||
}
|
||||
return err(false)
|
||||
}
|
||||
|
||||
async listAllMessagesByRoomId(id: string) {
|
||||
const result = await this.messageRemoteDataSourceService.getMessagesFromRoom(id)
|
||||
|
||||
@@ -105,7 +115,7 @@ export class MessageRepositoryService {
|
||||
return this.messageLocalDataSourceService.subscribeToNewMessage(roomId)
|
||||
}
|
||||
|
||||
sendTyping(ChatRoomId) {
|
||||
return this.messageLiveSignalRDataSourceService.sendTyping({ChatRoomId, UserName:SessionStore.user.FullName})
|
||||
sendTyping(roomId) {
|
||||
return this.messageLiveSignalRDataSourceService.sendTyping({roomId, UserName:SessionStore.user.FullName})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user