qa: New to delete assigned work
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
76472231fa
commit
f82152a462
@ -21,6 +21,7 @@ func declareTodoRoutes(router *gin.RouterGroup) {
|
|||||||
|
|
||||||
func declareTodoManagerRoutes(router *gin.RouterGroup) {
|
func declareTodoManagerRoutes(router *gin.RouterGroup) {
|
||||||
router.POST("/qa_assign_work", assignWork)
|
router.POST("/qa_assign_work", assignWork)
|
||||||
|
router.DELETE("/qa_assign_work", deleteAssignedWork)
|
||||||
router.POST("/qa_my_exercices.json", addQAView)
|
router.POST("/qa_my_exercices.json", addQAView)
|
||||||
router.POST("/qa_work.json", createQATodo)
|
router.POST("/qa_work.json", createQATodo)
|
||||||
|
|
||||||
@ -316,3 +317,24 @@ func assignWork(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, "true")
|
c.JSON(http.StatusOK, "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteAssignedWork(c *gin.Context) {
|
||||||
|
teams, err := fic.GetTeams()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Unable to GetTeams: ", err.Error())
|
||||||
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": fmt.Sprintf("Unable to list teams: %s", err.Error())})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, team := range teams {
|
||||||
|
todos, err := team.GetQATodo()
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Todo not found."})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, t := range todos {
|
||||||
|
t.Delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user