MCPcopy Create free account
hub / github.com/astercloud/aster / List

Method List

server/handlers/workflow.go:141–176  ·  view source on GitHub ↗

List lists all workflows

(c *gin.Context)

Source from the content-addressed store, hash-verified

139
140// List lists all workflows
141func (h *WorkflowHandler) List(c *gin.Context) {
142 ctx := c.Request.Context()
143 status := c.Query("status")
144
145 records, err := (*h.store).List(ctx, "workflows")
146 if err != nil {
147 c.JSON(http.StatusInternalServerError, gin.H{
148 "success": false,
149 "error": gin.H{
150 "code": "internal_error",
151 "message": "Failed to list workflows: " + err.Error(),
152 },
153 })
154 return
155 }
156
157 workflows := make([]*WorkflowRecord, 0)
158 for _, record := range records {
159 var wf WorkflowRecord
160 if err := store.DecodeValue(record, &wf); err != nil {
161 continue
162 }
163
164 // Filter by status
165 if status != "" && wf.Status != status {
166 continue
167 }
168
169 workflows = append(workflows, &wf)
170 }
171
172 c.JSON(http.StatusOK, gin.H{
173 "success": true,
174 "data": workflows,
175 })
176}
177
178// Get retrieves a single workflow
179func (h *WorkflowHandler) Get(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

DecodeValueFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
QueryMethod · 0.65
ListMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected