2020-09-08 10:50:41 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2022-11-06 15:36:31 +00:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
2020-09-08 10:50:41 +00:00
|
|
|
)
|
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
func declareVersionRoutes(router *gin.RouterGroup) {
|
|
|
|
router.GET("/version", showVersion)
|
2020-09-08 10:50:41 +00:00
|
|
|
}
|
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
func showVersion(c *gin.Context) {
|
|
|
|
teamid := c.MustGet("LoggedTeam").(int64)
|
|
|
|
ficteam := c.MustGet("LoggedUser").(string)
|
|
|
|
|
2023-07-25 07:04:31 +00:00
|
|
|
var ismanager bool
|
|
|
|
|
|
|
|
for _, manager := range ManagerUsers {
|
|
|
|
if manager == ficteam {
|
|
|
|
ismanager = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-06 15:36:31 +00:00
|
|
|
c.JSON(http.StatusOK, gin.H{
|
2023-11-25 12:43:41 +00:00
|
|
|
"version": 0.3,
|
2022-11-06 15:36:31 +00:00
|
|
|
"auth": map[string]interface{}{
|
2023-07-25 07:04:31 +00:00
|
|
|
"name": ficteam,
|
|
|
|
"id_team": teamid,
|
|
|
|
"is_manager": ismanager,
|
2022-11-06 15:36:31 +00:00
|
|
|
},
|
|
|
|
})
|
2020-09-08 10:50:41 +00:00
|
|
|
}
|