MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / BuildTaskListResponse

Function BuildTaskListResponse

service/explorer/response.go:108–123  ·  view source on GitHub ↗
(tasks []queue.Task, res *inventory.ListTaskResult, nodeMap map[int]*ent.Node, hasher hashid.Encoder)

Source from the content-addressed store, hash-verified

106}
107
108func BuildTaskListResponse(tasks []queue.Task, res *inventory.ListTaskResult, nodeMap map[int]*ent.Node, hasher hashid.Encoder) *TaskListResponse {
109 return &TaskListResponse{
110 Pagination: res.PaginationResults,
111 Tasks: lo.Map(tasks, func(t queue.Task, index int) TaskResponse {
112 var (
113 node *ent.Node
114 s = t.Summarize(hasher)
115 )
116
117 if s.NodeID > 0 {
118 node = nodeMap[s.NodeID]
119 }
120 return *BuildTaskResponse(t, node, hasher)
121 }),
122 }
123}
124
125func BuildTaskResponse(task queue.Task, node *ent.Node, hasher hashid.Encoder) *TaskResponse {
126 model := task.Model()

Callers 1

ListTasksMethod · 0.85

Calls 2

BuildTaskResponseFunction · 0.85
SummarizeMethod · 0.65

Tested by

no test coverage detected