Files
socket-service/src/types/types.ts
2026-02-23 23:56:20 +03:00

48 lines
765 B
TypeScript

export interface WebSocketData {
chatId?: string
token?: string
userId: number
email: string
}
export enum DATATYPE {
CHATS_LIST = 'CHATS_LIST',
CHATS_CREATE = 'CHATS_CREATE',
USERS_LIST = 'USERS_LIST',
USER_GET = 'USER_GET',
MESSAGES_LIST = 'MESSAGES_LIST',
MESSAGE_CREATE = 'MESSAGE_CREATE',
STATUS = 'STATUS',
ERROR = 'ERROR',
}
export type LoginDto = { email: string }
interface ListMessages {
type: 'GET_MESSAGES'
data: {
chat_id: string
}
}
interface CreateMessage {
type: 'CREATE_MESSAGE'
data: {
chat_id: string
text: string
}
}
interface UserData {
type: 'user'
id: number
}
interface MessageData {
type: 'message'
id: number
text: string
}
export type WsData = ListMessages | CreateMessage