qa: New to delete assigned work
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a1b0e6a79b
commit
9e75386038
@ -21,6 +21,7 @@ func declareTodoRoutes(router *gin.RouterGroup) {
|
||||
|
||||
func declareTodoManagerRoutes(router *gin.RouterGroup) {
|
||||
router.POST("/qa_assign_work", assignWork)
|
||||
router.DELETE("/qa_assign_work", deleteAssignedWork)
|
||||
router.POST("/qa_my_exercices.json", addQAView)
|
||||
router.POST("/qa_work.json", createQATodo)
|
||||
|
||||
@ -316,3 +317,24 @@ func assignWork(c *gin.Context) {
|
||||
|
||||
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