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
1 changed files with 22 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue