Some checks reported errors
continuous-integration/drone/push Build was killed
- 搭建 api、auth、utils 等逻辑模块 - 通过 tsc、eslint、vitest 测试验证 BREAKING CHANGE: 新镜像分支
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import type { User } from '../index';
|
|
import type { ChatMessageType, ChatMessageStatus } from './enum';
|
|
|
|
// 聊天消息接口
|
|
export interface ChatMessage {
|
|
id: string;
|
|
sessionId: string;
|
|
sender: User;
|
|
receiver: User;
|
|
content: string;
|
|
type: ChatMessageType;
|
|
status: ChatMessageStatus;
|
|
createdAt: Date;
|
|
// 非文本消息类型的元数据
|
|
metadata?: {
|
|
fileName?: string;
|
|
fileSize?: number;
|
|
duration?: number;
|
|
thumbnail?: string;
|
|
[key: string]: unknown;
|
|
};
|
|
}
|
|
|
|
// 聊天会话接口
|
|
export interface ChatSession {
|
|
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;
|
|
};
|
|
}
|