add member repository

This commit is contained in:
Peter Maquiran
2024-10-09 16:28:51 +01:00
parent e626883b5c
commit 9c65bee69c
15 changed files with 153 additions and 29 deletions
+3 -3
View File
@@ -4,11 +4,11 @@ import { ok, Result, err } from 'neverthrow';
import { SessionStore } from 'src/app/store/session.service';
import { filter, first, map } from 'rxjs/operators';
import { v4 as uuidv4 } from 'uuid'
import { ISignalRInput, ISignalROutput } from '../type';
import { ISignalRInput, ISignalROutput, ISocketMethod } from '../type';
import { MessageOutPutDataDTO } from 'src/app/core/chat/repository/dto/messageOutputDTO';
import { Subject } from 'rxjs';
export interface SocketMessage<T, I = any> {
method: string,
method: ISocketMethod,
data: T,
payload: I
}
@@ -166,7 +166,7 @@ export class SignalRConnection {
for(const method of methods) {
this.hubConnection.on(method, (message: any) => {
this.sendDataSubject.next({
method: method,
method: method as any,
data: message,
payload: this.payload[message?.requestId]
})
+29 -2
View File
@@ -1,7 +1,34 @@
import { z } from "zod";
let socketMethodSchema = z.enum([
'ReceiveMessage',
'TypingMessage',
'AvailableUsers',
'ReadAt',
'DeleteMessage',
'UpdateMessage',
'GroupAddedMembers',
'GroupDeletedMembers',
'UserAddGroup',
'RemoveRoomMember',
'TypingMessage',
'UserRemoveGroup', // no on the documentation
'GroupUpdate', // not in the documentation
'CreateGroup', // not on the documentation
'Typing',
'EditMessage',
'ReactMessage',
'AddRoomMember',
'SendDirectMessage',
'DeliverAt',
'sendMessage'
]);
export type ISocketMethod = z.infer<typeof socketMethodSchema>
const SignalRInputSchema = z.object({
method: z.string(),
method: socketMethodSchema,
data: z.object({
requestId: z.string(),
}).catchall(z.unknown()), // Allows any additional properties with unknown values
@@ -22,7 +49,7 @@ const SignalROutOutSchema = z.object({
})
export interface ISignalROutput<T = any> {
method: string;
method: ISocketMethod;
data: T;
payload: {
[key: string]: unknown; // Allows any additional properties with unknown values