mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
add member repository
This commit is contained in:
@@ -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]
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user