Files
ZYZ/shared/db/ChatInfo.ts
2021-02-28 21:28:09 +08:00

35 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
/**
* 记录聊天信息,包含配置、最近聊天等
**/
@modelOptions({ schemaOptions: { id: false } })
@index({ roleId: 1 })
export default class ChatInfo extends BaseModel {
@prop({ required: true, default: '' })
roleId: string; // 消息发送者 roleId
@prop({ required: true, default: '' })
roleName: string; // 消息发送者名称
@prop({ required: true, type: String, default: [] })
sources: [string]; // 打开的消息来源,主要用于系统通知筛选
@prop({ required: true, type: String, default: [] })
BSChannels: [string]; // 弹幕打开的频道BSbullet screen
@prop({ required: true, type: String, default: [] })
BSSources: [string]; // 弹幕打开的消息来源
@prop({ required: true, default: '' })
bubbleId: string; // 气泡编号
@prop({ required: true, type: String, default: [] })
recentPrivateChats: [{ // 最近聊天列表
targetRoleId: string; // 聊天玩家 roleId
roomId: string; // 聊天 Id
lastReadTime: Date; // 最后查看时间
}];
}
export const ChatInfoModel = getModelForClass(ChatInfo);
export interface ChatInfoType extends Pick<DocumentType<ChatInfo>, keyof ChatInfo> {};