feat: status constant define
This commit is contained in:
+14
-14
@@ -9,20 +9,20 @@ import (
|
||||
// Agent 远程执行代理
|
||||
type Agent struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"size:100;not null"` // Agent 名称
|
||||
Token string `json:"token" gorm:"size:64;index"` // 认证 Token(可重复使用)
|
||||
MachineID string `json:"machine_id" gorm:"size:64;uniqueIndex"` // 机器识别码(唯一)
|
||||
Description string `json:"description" gorm:"size:255"` // 描述
|
||||
Status string `json:"status" gorm:"size:20;default:'pending'"` // 状态: pending(待审核), online, offline, blocked(拉黑)
|
||||
LastSeen *LocalTime `json:"last_seen"` // 最后心跳时间
|
||||
IP string `json:"ip" gorm:"size:45"` // Agent IP 地址
|
||||
Version string `json:"version" gorm:"size:50"` // Agent 版本
|
||||
BuildTime string `json:"build_time" gorm:"size:30"` // Agent 构建时间
|
||||
Hostname string `json:"hostname" gorm:"size:100"` // Agent 主机名
|
||||
OS string `json:"os" gorm:"size:20"` // 操作系统
|
||||
Arch string `json:"arch" gorm:"size:20"` // 架构
|
||||
ForceUpdate bool `json:"force_update" gorm:"default:false"` // 强制更新标志
|
||||
Enabled bool `json:"enabled" gorm:"default:true"` // 是否启用
|
||||
Name string `json:"name" gorm:"size:100;not null"` // Agent 名称
|
||||
Token string `json:"token" gorm:"size:64;index"` // 认证 Token(可重复使用)
|
||||
MachineID string `json:"machine_id" gorm:"size:64;uniqueIndex"` // 机器识别码(唯一)
|
||||
Description string `json:"description" gorm:"size:255"` // 描述
|
||||
Status string `json:"status" gorm:"size:20;default:'pending';index"` // 状态: constant.AgentStatusOnline, constant.AgentStatusOffline
|
||||
LastSeen *LocalTime `json:"last_seen"` // 最后心跳时间
|
||||
IP string `json:"ip" gorm:"size:45"` // Agent IP 地址
|
||||
Version string `json:"version" gorm:"size:50"` // Agent 版本
|
||||
BuildTime string `json:"build_time" gorm:"size:30"` // Agent 构建时间
|
||||
Hostname string `json:"hostname" gorm:"size:100"` // Agent 主机名
|
||||
OS string `json:"os" gorm:"size:20"` // 操作系统
|
||||
Arch string `json:"arch" gorm:"size:20"` // 架构
|
||||
ForceUpdate bool `json:"force_update" gorm:"default:false"` // 强制更新标志
|
||||
Enabled bool `json:"enabled" gorm:"default:true"` // 是否启用
|
||||
CreatedAt LocalTime `json:"created_at"`
|
||||
UpdatedAt LocalTime `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||
|
||||
@@ -10,7 +10,7 @@ type LoginLog struct {
|
||||
Username string `json:"username" gorm:"size:100;index;not null"`
|
||||
IP string `json:"ip" gorm:"size:50"`
|
||||
UserAgent string `json:"user_agent" gorm:"size:500"`
|
||||
Status string `json:"status" gorm:"size:20"` // success, failed
|
||||
Status string `json:"status" gorm:"size:20;index"` // success, failed
|
||||
Message string `json:"message" gorm:"size:255"`
|
||||
CreatedAt LocalTime `json:"created_at" gorm:"index"`
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ type Task struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"size:255;not null"`
|
||||
Command string `json:"command" gorm:"type:text"` // 普通任务的命令
|
||||
Type string `json:"type" gorm:"size:20;default:'task'"` // 任务类型: task(普通任务), repo(仓库同步)
|
||||
Type string `json:"type" gorm:"size:20;default:'task'"` // 任务类型: constant.TaskTypeNormal, constant.TaskTypeRepo
|
||||
Config string `json:"config" gorm:"type:text"` // 配置 JSON(仓库同步配置等)
|
||||
Schedule string `json:"schedule" gorm:"size:100"` // cron expression
|
||||
Timeout int `json:"timeout" gorm:"default:30"` // 超时时间(分钟),默认30分钟
|
||||
@@ -92,10 +92,10 @@ type TaskLog struct {
|
||||
TaskID uint `json:"task_id" gorm:"index"`
|
||||
AgentID *uint `json:"agent_id" gorm:"index"` // Agent ID,为空表示本地执行
|
||||
Command string `json:"command" gorm:"type:text"`
|
||||
Output string `json:"-" gorm:"type:longtext"` // gzip+base64 compressed
|
||||
Error string `json:"error" gorm:"type:text"` // 额外的系统错误信息
|
||||
Status string `json:"status" gorm:"size:20"` // success, failed
|
||||
Duration int64 `json:"duration"` // milliseconds
|
||||
Output string `json:"-" gorm:"type:longtext"` // gzip+base64 compressed
|
||||
Error string `json:"error" gorm:"type:text"` // 额外的系统错误信息
|
||||
Status string `json:"status" gorm:"size:20;index"` // success, failed
|
||||
Duration int64 `json:"duration"` // milliseconds
|
||||
ExitCode int `json:"exit_code"`
|
||||
StartTime *LocalTime `json:"start_time"`
|
||||
EndTime *LocalTime `json:"end_time"`
|
||||
|
||||
Reference in New Issue
Block a user