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

Method Resume

server/handlers/workflow.go:533–577  ·  view source on GitHub ↗

Resume resumes a workflow

(c *gin.Context)

Source from the content-addressed store, hash-verified

531
532// Resume resumes a workflow
533func (h *WorkflowHandler) Resume(c *gin.Context) {
534 ctx := c.Request.Context()
535 id := c.Param("id")
536
537 var workflow WorkflowRecord
538 if err := (*h.store).Get(ctx, "workflows", id, &workflow); err != nil {
539 if errors.Is(err, store.ErrNotFound) {
540 c.JSON(http.StatusNotFound, gin.H{
541 "success": false,
542 "error": gin.H{
543 "code": "not_found",
544 "message": "Workflow not found",
545 },
546 })
547 return
548 }
549 c.JSON(http.StatusInternalServerError, gin.H{
550 "success": false,
551 "error": gin.H{
552 "code": "internal_error",
553 "message": "Failed to get workflow: " + err.Error(),
554 },
555 })
556 return
557 }
558
559 workflow.Status = "active"
560 workflow.UpdatedAt = time.Now()
561
562 if err := (*h.store).Set(ctx, "workflows", id, &workflow); err != nil {
563 c.JSON(http.StatusInternalServerError, gin.H{
564 "success": false,
565 "error": gin.H{
566 "code": "internal_error",
567 "message": "Failed to resume workflow: " + err.Error(),
568 },
569 })
570 return
571 }
572
573 c.JSON(http.StatusOK, gin.H{
574 "success": true,
575 "data": &workflow,
576 })
577}

Callers

nothing calls this directly

Calls 5

JSONMethod · 0.80
ContextMethod · 0.65
GetMethod · 0.65
ErrorMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected