You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/server/plugins/com.msgbyte.simplenotify/models/simplenotify.ts

45 lines
799 B
TypeScript

import { db } from 'tailchat-server-sdk';
const { getModelForClass, prop, modelOptions, TimeStamps } = db;
@modelOptions({
options: {
customName: 'p_simplenotify',
},
})
export class SimpleNotify extends TimeStamps implements db.Base {
_id: db.Types.ObjectId;
id: string;
@prop({
default: 'group',
})
type: 'user' | 'group';
// 群组
@prop()
groupId?: string;
@prop()
textPanelId?: string;
// 个人
@prop()
userConverseId?: string;
get converseId(): string {
if (this.type === 'user') {
return this.userConverseId;
}
return this.textPanelId;
}
}
export type SimpleNotifyDocument = db.DocumentType<SimpleNotify>;
const model = getModelForClass(SimpleNotify);
export type SimpleNotifyModel = typeof model;
export default model;