remove method to infra added to message repository

This commit is contained in:
Peter Maquiran
2024-08-27 16:04:29 +01:00
parent 7800b65cba
commit 6c0a15fb7c
5 changed files with 34 additions and 57 deletions
@@ -1,6 +1,4 @@
import { Injectable } from '@angular/core';
import { err, ok } from 'neverthrow';
import { SessionStore } from 'src/app/store/session.service';
import { MessageDeleteInputDTO } from '../../dto/message/messageDeleteInputDTO';
import { v4 as uuidv4 } from 'uuid'
import { InstanceId } from '../../../domain/chat-service.service';
@@ -9,6 +7,8 @@ import { MessageOutPutDataDTO } from '../../dto/message/messageOutputDTO';
import { MessageInputDTO } from '../../dto/message/messageInputDtO';
import { MessageReactionInput } from '../../../domain/use-case/message/message-reaction-by-id-use-case.service';
import { SignalRService } from 'src/app/infra/socket/signalR/signal-r.service';
import { filter, map } from 'rxjs/operators';
import { SocketMessage } from 'src/app/infra/socket/signalR/signalR';
interface msgObj {
roomId: string;
@@ -109,17 +109,28 @@ export class MessageSocketRepositoryService {
}
listenToMessages() {
return this.socket.getMessage()
return this.socket.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'ReceiveMessage'
),
map((e)=> e.data)
)
}
listenToDeleteMessages() {
return this.socket.getMessageDelete()
return this.socket.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'DeleteMessage'
),
map((e)=> e.data)
)
}
listenToUpdateMessages() {
return this.socket.getMessageUpdate()
return this.socket.getData().pipe(
filter((e) : e is SocketMessage<MessageOutPutDataDTO>=> e?.method == 'UpdateMessage'
),
map((e)=> e.data)
)
}