DeleteTaskEndpoint deletes an agent task. @Summary Delete an agent task @Tags agent-jobs @Produce json @Param id path string true "Task ID" @Success 200 {object} map[string]string "message" @Failure 404 {object} map[string]string "error" @Router /api/agent/tasks/{id} [delete]
(app *application.Application)
| 94 | // @Failure 404 {object} map[string]string "error" |
| 95 | // @Router /api/agent/tasks/{id} [delete] |
| 96 | func DeleteTaskEndpoint(app *application.Application) echo.HandlerFunc { |
| 97 | return func(c echo.Context) error { |
| 98 | id := c.Param("id") |
| 99 | if err := getJobService(app, c).DeleteTask(id); err != nil { |
| 100 | if errors.Is(err, agentpool.ErrTaskNotFound) { |
| 101 | return c.JSON(http.StatusNotFound, map[string]string{"error": err.Error()}) |
| 102 | } |
| 103 | return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) |
| 104 | } |
| 105 | |
| 106 | return c.JSON(http.StatusOK, map[string]string{"message": "Task deleted"}) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // ListTasksEndpoint lists all agent tasks for the current user. |
| 111 | // @Summary List agent tasks |
no test coverage detected