diff --git a/main_dc/yalarba/api_es/internal/models/base.go b/main_dc/yalarba/api_es/internal/models/base.go index 1d6445e..cb22250 100644 --- a/main_dc/yalarba/api_es/internal/models/base.go +++ b/main_dc/yalarba/api_es/internal/models/base.go @@ -9,4 +9,6 @@ type Base struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` - DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` \ No newline at end of file + DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` + UpdateHistories []UpdateHistory `gorm:"polymorphic:Model;polymorphicValue:base" json:"-"` // полностью скрываем +} diff --git a/main_dc/yalarba/api_es/internal/models/update_history.go b/main_dc/yalarba/api_es/internal/models/update_history.go new file mode 100644 index 0000000..e70c1d7 --- /dev/null +++ b/main_dc/yalarba/api_es/internal/models/update_history.go @@ -0,0 +1,13 @@ +package models + +import ( + "time" +) + +type UpdateHistory struct { + ID uint `gorm:"primaryKey" json:"-"` + ModelID uint `json:"-"` + ModelType string `json:"-"` + Timestamp time.Time `json:"-"` + UpdatedBy uint `gorm:"index" json:"-"` +} \ No newline at end of file