(c *gin.Context)
| 112 | } |
| 113 | |
| 114 | func cancelTask(c *gin.Context) { |
| 115 | r := struct { |
| 116 | ID int64 `json:"id" form:"id" uri:"id" binding:"required"` |
| 117 | }{} |
| 118 | |
| 119 | _ = c.ShouldBindUri(&r) |
| 120 | |
| 121 | if err := c.ShouldBind(&r); err != nil { |
| 122 | abortWithError(c, http.StatusBadRequest, err) |
| 123 | return |
| 124 | } |
| 125 | |
| 126 | developer := getDeveloperID(c) |
| 127 | task, err := model.GetTask(model.GetDB(c), developer, r.ID) |
| 128 | if err != nil { |
| 129 | _ = c.Error(err) |
| 130 | abortWithError(c, http.StatusForbidden, ErrGetTaskDetailFailed) |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | // call task executor to abort |
| 135 | getTaskManager(c).Kill(task.ID) |
| 136 | } |
nothing calls this directly
no test coverage detected