聊天:加入大部分聊天所需数据库表
This commit is contained in:
34
shared/db/ChatInfo.ts
Normal file
34
shared/db/ChatInfo.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
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]; // 弹幕打开的频道,BS:bullet 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> {};
|
||||
Reference in New Issue
Block a user