Files
2026-04-25 16:36:34 +08:00

43 lines
1.1 KiB
TypeScript
Raw Permalink 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.
/**
* 删除记录模型
* 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;