2020-09-08 10:50:41 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2023-07-25 07:04:31 +00:00
|
|
|
"net/http"
|
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
"github.com/gin-gonic/gin"
|
2020-09-08 10:50:41 +00:00
|
|
|
)
|
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
func DeclareRoutes(router *gin.RouterGroup) {
|
|
|
|
apiRoutes := router.Group("/api")
|
|
|
|
apiRoutes.Use(authMiddleware())
|
2020-09-08 10:50:41 +00:00
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
declareExercicesRoutes(apiRoutes)
|
|
|
|
declareQARoutes(apiRoutes)
|
|
|
|
declareThemesRoutes(apiRoutes)
|
|
|
|
declareTodoRoutes(apiRoutes)
|
|
|
|
declareVersionRoutes(apiRoutes)
|
2023-11-25 12:43:41 +00:00
|
|
|
declareGitlabRoutes(router, apiRoutes)
|
2023-07-25 07:04:31 +00:00
|
|
|
|
|
|
|
apiManagerRoutes := router.Group("/api")
|
|
|
|
apiManagerRoutes.Use(authMiddleware(func(ficteam string, teamid int64, c *gin.Context) bool {
|
|
|
|
for _, manager := range ManagerUsers {
|
|
|
|
if manager == ficteam {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"errmsg": "Not authorized."})
|
|
|
|
return false
|
|
|
|
}))
|
|
|
|
|
|
|
|
declareTodoManagerRoutes(apiManagerRoutes)
|
2023-07-25 09:17:40 +00:00
|
|
|
declareTeamsRoutes(apiManagerRoutes)
|
2020-09-08 10:50:41 +00:00
|
|
|
}
|