43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
|
|
/**
|
|||
|
|
* 删除记录模型
|
|||
|
|
* TypeGoose 定义,符合 Tailchat 插件标准模式
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
import { db } from 'tailchat-server-sdk';
|
|||
|
|
const { getModelForClass, prop, modelOptions, TimeStamps } = db;
|
|||
|
|
|
|||
|
|
@modelOptions({ options: { customName: 'p_saleschat_deletionrecord' } })
|
|||
|
|
export class DeletionRecord extends TimeStamps implements db.Base {
|
|||
|
|
_id: db.Types.ObjectId;
|
|||
|
|
id: string;
|
|||
|
|
|
|||
|
|
/** 被删除用户 ID(关联用户) */
|
|||
|
|
@prop({ required: true, ref: 'User' })
|
|||
|
|
userId: db.Types.ObjectId;
|
|||
|
|
|
|||
|
|
/** 用户名 */
|
|||
|
|
@prop()
|
|||
|
|
username?: string;
|
|||
|
|
|
|||
|
|
/** 操作人 ID(关联用户) */
|
|||
|
|
@prop({ required: true, ref: 'User' })
|
|||
|
|
deletedBy: db.Types.ObjectId;
|
|||
|
|
|
|||
|
|
/** 删除类型:soft / hard */
|
|||
|
|
@prop({ default: 'soft' })
|
|||
|
|
type: 'soft' | 'hard';
|
|||
|
|
|
|||
|
|
/** 原因 */
|
|||
|
|
@prop({ default: '无' })
|
|||
|
|
reason: string;
|
|||
|
|
|
|||
|
|
/** 删除时间 */
|
|||
|
|
@prop({ default: () => new Date() })
|
|||
|
|
deletedAt: Date;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export type DeletionRecordDocument = db.DocumentType<DeletionRecord>;
|
|||
|
|
const model = getModelForClass(DeletionRecord);
|
|||
|
|
export type DeletionRecordModel = typeof model;
|
|||
|
|
export default model;
|