GetExecutionDetails retrieves a single execution
(c *gin.Context)
| 451 | |
| 452 | // GetExecutionDetails retrieves a single execution |
| 453 | func (h *WorkflowHandler) GetExecutionDetails(c *gin.Context) { |
| 454 | ctx := c.Request.Context() |
| 455 | executionID := c.Param("eid") |
| 456 | |
| 457 | var execution WorkflowExecution |
| 458 | if err := (*h.store).Get(ctx, "workflow_executions", executionID, &execution); err != nil { |
| 459 | if errors.Is(err, store.ErrNotFound) { |
| 460 | c.JSON(http.StatusNotFound, gin.H{ |
| 461 | "success": false, |
| 462 | "error": gin.H{ |
| 463 | "code": "not_found", |
| 464 | "message": "Execution not found", |
| 465 | }, |
| 466 | }) |
| 467 | return |
| 468 | } |
| 469 | c.JSON(http.StatusInternalServerError, gin.H{ |
| 470 | "success": false, |
| 471 | "error": gin.H{ |
| 472 | "code": "internal_error", |
| 473 | "message": "Failed to get execution: " + err.Error(), |
| 474 | }, |
| 475 | }) |
| 476 | return |
| 477 | } |
| 478 | |
| 479 | c.JSON(http.StatusOK, gin.H{ |
| 480 | "success": true, |
| 481 | "data": &execution, |
| 482 | }) |
| 483 | } |
| 484 | |
| 485 | // Suspend suspends a workflow |
| 486 | func (h *WorkflowHandler) Suspend(c *gin.Context) { |