Filter repositories route by work if defined
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0ab96472e4
commit
f615d0b8d8
@ -55,7 +55,19 @@ func declareAPIAuthRepositoriesRoutes(router *gin.RouterGroup) {
|
||||
return
|
||||
}
|
||||
|
||||
if work, ok := c.Get("work"); ok {
|
||||
var res []*Repository
|
||||
|
||||
for _, r := range repositories {
|
||||
if r.IdWork == work.(*Work).Id {
|
||||
res = append(res, r)
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, res)
|
||||
} else {
|
||||
c.JSON(http.StatusOK, repositories)
|
||||
}
|
||||
})
|
||||
router.POST("/repositories", func(c *gin.Context) {
|
||||
var u *User
|
||||
|
Reference in New Issue
Block a user