@Summary Delete Task @Description **Delete completed task by given ID. Does not stop task execution** @Tags Tasks @Produce json @Param id path int true "Task ID" @Success 200 {object} task.Task @Failure 500 {object} Error "invalid syntax, bad ID?" @Failure 400 {object} Error "Task in progress or not
(c *gin.Context)
| 185 | // @Failure 400 {object} Error "Task in progress or not found" |
| 186 | // @Router /api/tasks/{id} [delete] |
| 187 | func apiTasksDelete(c *gin.Context) { |
| 188 | list := context.TaskList() |
| 189 | id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0) |
| 190 | if err != nil { |
| 191 | AbortWithJSONError(c, 500, err) |
| 192 | return |
| 193 | } |
| 194 | |
| 195 | var delTask task.Task |
| 196 | delTask, err = list.DeleteTaskByID(int(id)) |
| 197 | if err != nil { |
| 198 | AbortWithJSONError(c, 400, err) |
| 199 | return |
| 200 | } |
| 201 | |
| 202 | c.JSON(200, delTask) |
| 203 | } |
nothing calls this directly
no test coverage detected