server/qa/api/version.go

35 lines
579 B
Go
Raw Normal View History

package api
import (
2022-11-06 15:36:31 +00:00
"net/http"
"github.com/gin-gonic/gin"
)
2022-11-06 15:36:31 +00:00
func declareVersionRoutes(router *gin.RouterGroup) {
router.GET("/version", showVersion)
}
2022-11-06 15:36:31 +00:00
func showVersion(c *gin.Context) {
teamid := c.MustGet("LoggedTeam").(int64)
ficteam := c.MustGet("LoggedUser").(string)
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{}{
"name": ficteam,
"id_team": teamid,
"is_manager": ismanager,
2022-11-06 15:36:31 +00:00
},
})
}