feat(reset): 以构造器模式重构
- 加了大文件传输自定义分片协议 BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
@@ -1,47 +1,25 @@
|
||||
import type { User } from '../index';
|
||||
import type { ChatMessageType, ChatMessageStatus } from './enum';
|
||||
import type { UserProfile } from '../user';
|
||||
import type { ChatMessageType } from './types';
|
||||
import type { BaseEntity } from '../common';
|
||||
|
||||
// 聊天消息接口
|
||||
export interface ChatMessage {
|
||||
id: string;
|
||||
export interface ChatMessage extends BaseEntity {
|
||||
// 聊天会话id,下面那个接口的id
|
||||
sessionId: string;
|
||||
sender: User;
|
||||
receiver: User;
|
||||
content: string;
|
||||
type: ChatMessageType;
|
||||
status: ChatMessageStatus;
|
||||
chatSessionId: string;
|
||||
sender: UserProfile;
|
||||
receiver: UserProfile;
|
||||
content: string; // 只支持文本信息
|
||||
type: ChatMessageType; // 实际无用
|
||||
createdAt: Date;
|
||||
// 非文本消息类型的元数据
|
||||
metadata?: {
|
||||
fileName?: string;
|
||||
fileSize?: number;
|
||||
duration?: number;
|
||||
// 小图预览
|
||||
thumbnail?: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
// 无元数据,因为只有文本消息
|
||||
}
|
||||
|
||||
// 聊天会话接口
|
||||
export interface ChatSession {
|
||||
export interface ChatSession extends BaseEntity {
|
||||
id: string;
|
||||
participant1Id: string;
|
||||
participant2Id: string;
|
||||
participant1: User;
|
||||
participant2: User;
|
||||
lastMessage?: {
|
||||
id: string;
|
||||
content: string;
|
||||
senderId: string;
|
||||
createdAt: Date;
|
||||
};
|
||||
unreadCount1: number; // 参与者1的未读消息数
|
||||
unreadCount2: number; // 参与者2的未读消息数
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
// 会话元数据(特殊标记、背景设置、自定义属性等等)
|
||||
metadata?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
participant1: UserProfile;
|
||||
participant2: UserProfile;
|
||||
// 用于在聊天列表显示最后一句话
|
||||
lastMessage?: ChatMessage;
|
||||
// 没有已读和未读
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user