Private
Public Access
30 lines
1023 B
Go
30 lines
1023 B
Go
package logs
|
|
|
|
import (
|
|
"time"
|
|
|
|
models_seguridad "repuestera_back/models/seguridad"
|
|
)
|
|
|
|
type LogDetalle struct {
|
|
NombreTabla string `json:"nombreTabla"`
|
|
Columna string `json:"columna"`
|
|
ValorAnterior string `json:"valorAnterior,omitempty"`
|
|
ValorNuevo string `json:"valorNuevo,omitempty"`
|
|
}
|
|
|
|
type Log struct {
|
|
ID uint64 `gorm:"primaryKey" json:"id"`
|
|
EmpresaID string `gorm:"type:varchar(3);index;not null" json:"empresaId"`
|
|
UsuarioID uint `gorm:"index;not null" json:"usuarioId"`
|
|
Accion string `gorm:"type:varchar(50);not null" json:"accion"`
|
|
Detalles []LogDetalle `gorm:"type:json" json:"detalles,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Empresa models_seguridad.Empresa `gorm:"foreignKey:EmpresaID" json:"empresa,omitempty"`
|
|
Usuario models_seguridad.Usuario `gorm:"foreignKey:UsuarioID" json:"usuario,omitempty"`
|
|
}
|
|
|
|
func (Log) TableName() string {
|
|
return "logs"
|
|
}
|