feat: add task pin #89

This commit is contained in:
duorameng
2026-04-29 18:02:43 +08:00
parent b4709ef873
commit 685d79b54e
10 changed files with 186 additions and 65 deletions
+1
View File
@@ -71,6 +71,7 @@ type Task struct {
ID string `json:"id" gorm:"primaryKey;size:20"`
Name string `json:"name" gorm:"size:255;not null"`
Remark string `json:"remark" gorm:"size:255;default:''"`
PinType string `json:"pin_type" gorm:"size:20;default:none;index"` // 置顶类型: constant.PinTypeNone, constant.PinTypeTop
Command BigText `json:"command"` // 普通任务的命令
Tags string `json:"tags" gorm:"size:255;default:''"` // 标签,逗号分隔
Type string `json:"type" gorm:"size:20;default:'task'"` // 任务类型: constant.TaskTypeNormal, constant.TaskTypeRepo
+2
View File
@@ -27,6 +27,7 @@ type TaskVO struct {
RetryCount int `json:"retry_count"`
RetryInterval int `json:"retry_interval"`
RandomRange int `json:"random_range"`
PinType string `json:"pin_type"`
LastRun *models.LocalTime `json:"last_run"`
NextRun *models.LocalTime `json:"next_run"`
CreatedAt models.LocalTime `json:"created_at"`
@@ -58,6 +59,7 @@ func ToTaskVO(task *models.Task) *TaskVO {
RetryCount: task.RetryCount,
RetryInterval: task.RetryInterval,
RandomRange: task.RandomRange,
PinType: task.PinType,
LastRun: task.LastRun,
NextRun: task.NextRun,
CreatedAt: task.CreatedAt,