import { OperateType } from '../../../constants'; import { DateField, EnumField, StringField, UUIDField, } from '../../../decorators'; import { type AuditLogEntity } from '../audit-log.entity'; export class ReportAuditLogDto { @DateField() date!: Date; @StringField() username!: string; @StringField() tableName!: string; @UUIDField() itemId!: Uuid; @EnumField(() => OperateType) operateType!: OperateType; @StringField() summaryChanges!: string; constructor(auditLog: AuditLogEntity) { this.date = auditLog.createdAt; this.username = auditLog.user.name; this.itemId = auditLog.itemId; this.operateType = auditLog.operateType; this.tableName = auditLog.tableName; this.summaryChanges = auditLog.summaryChanges; } }