New route to stop all running/pending tests for a given work
This commit is contained in:
parent
8b8f3947f8
commit
bcf76a2c86
4 changed files with 90 additions and 0 deletions
12
works.go
12
works.go
|
@ -153,6 +153,18 @@ func declareAPIAdminWorksRoutes(router *gin.RouterGroup) {
|
|||
|
||||
c.JSON(http.StatusOK, nil)
|
||||
})
|
||||
worksRoutes.DELETE("/tests", func(c *gin.Context) {
|
||||
w := c.MustGet("work").(*Work)
|
||||
|
||||
err := w.stopTests()
|
||||
if err != nil {
|
||||
log.Println("Unable to stop tests:", err)
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during test stop."})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, true)
|
||||
})
|
||||
|
||||
// Grades related to works
|
||||
worksRoutes.GET("/grades", func(c *gin.Context) {
|
||||
|
|
Reference in a new issue