Skip to content

Commit

Permalink
fix: update delete task job and list tasks job api args.
Browse files Browse the repository at this point in the history
Signed-off-by: Asklv <[email protected]>
  • Loading branch information
IRONICBo committed Aug 4, 2024
1 parent dcbb0f7 commit 572d87c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
20 changes: 8 additions & 12 deletions internal/job/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,29 @@ type PreheatResponse struct {

// ListTasksRequest defines the request parameters for listing tasks.
type ListTasksRequest struct {
TaskID string `json:"task_id" validate:"required"`
Page int `json:"page" validate:"required"`
PerPage int `json:"per_page" validate:"required"`
TaskID string `json:"task_id" validate:"required"`
}

// ListTasksResponse defines the response parameters for listing tasks.
type ListTasksResponse struct {
Peers []*resource.Peer `json:"peers"`
Page int `json:"page"`
Total int `json:"total"`
}

// DeleteTaskRequest defines the request parameters for deleting task.
type DeleteTaskRequest struct {
TaskID string `json:"task_id" validate:"required"`
}

// TaskInfo includes information about a task along with peer details and a description.
type TaskInfo struct {
Task *resource.Task `json:"task"`
Peer *resource.Peer `json:"peer"`
Desc string `json:"desc"`
// Task includes information about a task along with peer details and a description.
type Task struct {
Task *resource.Task `json:"task"`
Peer *resource.Peer `json:"peer"`
Description string `json:"description"`
}

// DeleteTaskResponse represents the response after attempting to delete tasks,
// categorizing them into successfully and unsuccessfully deleted.
type DeleteTaskResponse struct {
SuccessTasks []*TaskInfo `json:"success_tasks"`
FailureTasks []*TaskInfo `json:"failure_tasks"`
SuccessTasks []*Task `json:"success_tasks"`
FailureTasks []*Task `json:"failure_tasks"`
}
4 changes: 1 addition & 3 deletions manager/types/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ type CreateListTasksJobRequest struct {
}

type ListTasksArgs struct {
TaskID string `json:"task_id" binding:"required"`
Page int `json:"page" binding:"omitempty,gte=1"`
PerPage int `json:"per_page" binding:"omitempty,gte=1,lte=10000000"`
TaskID string `json:"task_id" binding:"required"`
}

type PreheatArgs struct {
Expand Down

0 comments on commit 572d87c

Please sign in to comment.