26 lines
767 B
TypeScript
26 lines
767 B
TypeScript
import type { UserProfile } from '../user';
|
||
import type { ChatMessageType } from './types';
|
||
import type { BaseEntity } from '../common';
|
||
|
||
// 聊天消息接口
|
||
export interface ChatMessage extends BaseEntity {
|
||
// 聊天会话id,下面那个接口的id
|
||
chatSessionId: string;
|
||
sender: UserProfile;
|
||
receiver: UserProfile;
|
||
content: string; // 只支持文本信息
|
||
type: ChatMessageType; // 实际无用
|
||
createdAt: Date;
|
||
// 无元数据,因为只有文本消息
|
||
}
|
||
|
||
// 聊天会话接口
|
||
export interface ChatSession extends BaseEntity {
|
||
id: string;
|
||
participant1: UserProfile;
|
||
participant2: UserProfile;
|
||
// 用于在聊天列表显示最后一句话
|
||
lastMessage?: ChatMessage;
|
||
// 没有已读和未读
|
||
}
|