package domain

import "time"

// OperationLog 操作日志
type OperationLog struct {
	ID             int64     `gorm:"primaryKey;autoIncrement" json:"id"`
	UserID         *int64    `gorm:"index" json:"user_id,omitempty"`
	OperationType  string    `gorm:"type:varchar(50)" json:"operation_type"`
	OperationName  string    `gorm:"type:varchar(100)" json:"operation_name"`
	RequestMethod  string    `gorm:"type:varchar(10)" json:"request_method"`
	RequestPath    string    `gorm:"type:varchar(200)" json:"request_path"`
	RequestParams  string    `gorm:"type:text" json:"request_params"`
	ResponseStatus int       `json:"response_status"`
	IP             string    `gorm:"type:varchar(50)" json:"ip"`
	UserAgent      string    `gorm:"type:varchar(500)" json:"user_agent"`
	CreatedAt      time.Time `gorm:"autoCreateTime" json:"created_at"`
}

// TableName 指定表名
func (OperationLog) TableName() string {
	return "operation_logs"
}
