import { AbstractDto } from '../../../common/dto/abstract.dto'; import { OperateType } from '../../../constants'; import { EnumField, StringField, UUIDField } from '../../../decorators'; import { type AuditLogEntity } from '../audit-log.entity'; export class AuditLogDto extends AbstractDto { @EnumField(() => OperateType) operateType!: OperateType; @StringField() tableName!: string; @UUIDField() itemId!: Uuid; @StringField() summaryChanges!: string; @StringField() oldValue!: string | null; @StringField() newValue!: string | null; @StringField() username!: string; constructor(auditLog: AuditLogEntity) { super(auditLog); this.operateType = auditLog.operateType; this.tableName = auditLog.tableName; this.itemId = auditLog.itemId; this.summaryChanges = auditLog.summaryChanges; this.oldValue = auditLog.oldValue; this.newValue = auditLog.newValue; this.username = auditLog.user.name; } }