89 lines
3.0 KiB
Go
89 lines
3.0 KiB
Go
package dto
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type TaskRequest struct {
|
|
ID uint `json:"ID"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Spec string `json:"spec"`
|
|
WithSeconds bool `json:"withSeconds"`
|
|
ExecutorType string `json:"executorType"`
|
|
MethodName string `json:"methodName"`
|
|
Params json.RawMessage `json:"params"`
|
|
HTTPURL string `json:"httpUrl"`
|
|
HTTPMethod string `json:"httpMethod"`
|
|
HTTPHeader json.RawMessage `json:"httpHeader"`
|
|
HTTPBody string `json:"httpBody"`
|
|
HTTPAllowPrivate bool `json:"httpAllowPrivate"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
type DeleteTaskRequest struct {
|
|
ID uint `json:"ID" binding:"required"`
|
|
}
|
|
type ToggleTaskRequest struct {
|
|
ID uint `json:"ID" binding:"required"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
type TaskListRequest struct {
|
|
Page int `form:"page"`
|
|
PageSize int `form:"pageSize"`
|
|
Name string `form:"name"`
|
|
ExecutorType string `form:"executorType"`
|
|
Enabled *bool `form:"enabled"`
|
|
}
|
|
|
|
type TaskLogListRequest struct {
|
|
Page int `form:"page"`
|
|
PageSize int `form:"pageSize"`
|
|
TaskID uint `form:"taskId"`
|
|
Status string `form:"status"`
|
|
}
|
|
|
|
type TaskResponse struct {
|
|
ID uint `json:"ID"`
|
|
CreatedAt time.Time `json:"CreatedAt"`
|
|
UpdatedAt time.Time `json:"UpdatedAt"`
|
|
DeletedAt any `json:"-"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Spec string `json:"spec"`
|
|
WithSeconds bool `json:"withSeconds"`
|
|
ExecutorType string `json:"executorType"`
|
|
MethodName string `json:"methodName"`
|
|
Params json.RawMessage `json:"params"`
|
|
HTTPURL string `json:"httpUrl"`
|
|
HTTPMethod string `json:"httpMethod"`
|
|
HTTPHeader json.RawMessage `json:"httpHeader"`
|
|
HTTPBody string `json:"httpBody"`
|
|
HTTPAllowPrivate bool `json:"httpAllowPrivate"`
|
|
Enabled bool `json:"enabled"`
|
|
NextRunAt *time.Time `json:"nextRunAt"`
|
|
}
|
|
|
|
type TaskLogResponse struct {
|
|
ID uint `json:"ID"`
|
|
CreatedAt time.Time `json:"CreatedAt"`
|
|
UpdatedAt time.Time `json:"UpdatedAt"`
|
|
DeletedAt any `json:"-"`
|
|
TaskID uint `json:"taskId"`
|
|
TaskName string `json:"taskName"`
|
|
TriggerType string `json:"triggerType"`
|
|
StartedAt time.Time `json:"startedAt"`
|
|
FinishedAt time.Time `json:"finishedAt"`
|
|
DurationMS int64 `json:"durationMs"`
|
|
Status string `json:"status"`
|
|
ErrorMsg string `json:"errorMsg"`
|
|
Output string `json:"output"`
|
|
}
|
|
|
|
type TaskMethodResponse struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
}
|