recei and clear the code

This commit is contained in:
Peter Maquiran
2024-08-21 20:14:48 +01:00
parent 82c67b8976
commit 24aac56824
36 changed files with 319 additions and 246 deletions
@@ -8,6 +8,7 @@ import { InstanceId } from '../../../domain/chat-service.service';
import { MessageUpdateInput } from '../../../domain/use-case/message-update-by-id-use-case.service';
import { MessageOutPutDataDTO } from '../../dto/message/messageOutputDTO';
import { MessageInputDTO } from '../../dto/message/messageInputDtO';
import { MessageReactionInput } from '../../../domain/use-case/message-reaction-by-id-use-case.service';
interface msgObj {
roomId: string;
@@ -48,15 +49,18 @@ export class MessageSocketRepositoryService {
return this.socket.establishConnection();
}
async sendMessage(data: msgObj) {
async join() {
return await this.socket.join()
}
try {
const result = await this.socket.sendMessage(data)
return ok(result)
} catch (e) {
return err(e)
}
async sendGroupMessage(data: MessageInputDTO) {
const result = await this.socket.sendData<MessageOutPutDataDTO>({
method: 'sendMessage',
data: data,
})
return result;
}
async sendDirectMessage(data: MessageInputDTO) {
@@ -86,6 +90,15 @@ export class MessageSocketRepositoryService {
return result;
}
async sendDelete(data: MessageDeleteInputDTO) {
const result = await this.socket.sendData<any>({
method: 'ReadAt',
data: data,
})
return result;
}
listenToMessages() {
return this.socket.getMessage()
}
@@ -101,7 +114,7 @@ export class MessageSocketRepositoryService {
}
reactToMessageSocket(data) {
reactToMessageSocket(data: MessageReactionInput) {
this.socket.sendData({
method: 'ReactMessage',
data
@@ -115,23 +128,17 @@ export class MessageSocketRepositoryService {
})
}
sendTyping(roomId) {
return this.socket.sendTyping({
roomId,
UserName:SessionStore.user.FullName,
userId: SessionStore.user.UserId
})
}
sendMessageDelete(data: MessageDeleteInputDTO) {
data['requestId'] = InstanceId +'@'+ uuidv4();
return this.socket.sendMessageDelete(data)
const result = this.socket.sendData<any>({
method: 'DeleteMessage',
data: data,
})
return result;
}
}