add task
parent
f2322befd3
commit
250776bf27
|
|
@ -131,8 +131,8 @@ type EmptyResp struct{}
|
|||
|
||||
// PaginationReq 分页接口通用请求
|
||||
type PaginationReq struct {
|
||||
Offset int `json:"offset" in:"query=offset" validate:"gte=0"`
|
||||
Limit int `json:"limit" in:"query=limit" validate:"gte=0"`
|
||||
Offset int `json:"offset" req:"offset,in=query" validate:"gte=0"`
|
||||
Limit int `json:"limit" req:"limit,in=query" validate:"gte=0"`
|
||||
}
|
||||
|
||||
// PaginationResp 分页接口通用返回
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ func NewHandler(mgr *TaskManager, host string, routePrefix string) http.Handler
|
|||
}
|
||||
|
||||
// 任务管理
|
||||
mux.HandleFunc("POST /api/v1/task/update", rest.Handle(s.Update))
|
||||
mux.HandleFunc("POST /api/v1/task/retry", rest.Handle(s.Retry))
|
||||
mux.HandleFunc("POST /api/v1/task/revoke", rest.Handle(s.Revoke))
|
||||
mux.HandleFunc("GET /api/v1/task/status", rest.Handle(s.Status))
|
||||
mux.HandleFunc("GET /api/v1/task/list", rest.Handle(s.List))
|
||||
mux.HandleFunc("POST /update", rest.Handle(s.Update))
|
||||
mux.HandleFunc("POST /retry", rest.Handle(s.Retry))
|
||||
mux.HandleFunc("POST /revoke", rest.Handle(s.Revoke))
|
||||
mux.HandleFunc("GET /status", rest.Handle(s.Status))
|
||||
mux.HandleFunc("GET /list", rest.Handle(s.List))
|
||||
|
||||
return mux
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ func (s *service) Retry(ctx context.Context, req *RetryReq) (*rest.EmptyResp, er
|
|||
|
||||
// commonReq 任务请求参数
|
||||
type commonReq struct {
|
||||
TaskID string `json:"taskID" in:"query=taskID" validate:"required"`
|
||||
TaskID string `json:"taskID" req:"taskID,in=query" validate:"required"`
|
||||
}
|
||||
|
||||
// Revoke 取消任务
|
||||
|
|
@ -338,13 +338,13 @@ func (s *service) Status(ctx context.Context, req *commonReq) (*Task, error) {
|
|||
// ListReq ...
|
||||
type ListReq struct {
|
||||
rest.PaginationReq
|
||||
TaskID string `json:"taskID" in:"query=taskID"`
|
||||
TaskType string `json:"taskType" in:"query=taskType"`
|
||||
TaskName string `json:"taskName" in:"query=taskName"`
|
||||
TaskIndex string `json:"taskIndex" in:"query=taskIndex"`
|
||||
CurrentStep string `json:"currentStep" in:"query=currentStep"`
|
||||
Status string `json:"status" in:"query=status" validate:"oneof='' SUCCESS FAILURE RUNNING TIMEOUT REVOKED NOTSTARTED INITIALIZING"` // nolint
|
||||
Creator string `json:"creator" in:"query=creator"`
|
||||
TaskID string `json:"taskID" req:"taskID,in=query"`
|
||||
TaskType string `json:"taskType" req:"taskType,in=query"`
|
||||
TaskName string `json:"taskName" req:"taskType,in=query"`
|
||||
TaskIndex string `json:"taskIndex" req:"taskIndex,in=query"`
|
||||
CurrentStep string `json:"currentStep" req:"currentStep,in=query"`
|
||||
Status string `json:"status" req:"status,in=query" validate:"oneof='' SUCCESS FAILURE RUNNING TIMEOUT REVOKED NOTSTARTED INITIALIZING"` // nolint
|
||||
Creator string `json:"creator" req:"creator,in=query"`
|
||||
}
|
||||
|
||||
// List 任务分页列表
|
||||
|
|
|
|||
Loading…
Reference in New Issue