ADD: added new auth middleware and changed the roles value ind the jwt token to a array
This commit is contained in:
@@ -54,9 +54,11 @@ func main() {
|
||||
api.POST("/tournaments/:id/join", tournament.JoinTournament)
|
||||
api.PUT("/tournaments/:id", tournament.UpdateTournament)
|
||||
|
||||
api.GET("/players", func(c *gin.Context) {
|
||||
player.GetPlayers(c, db.GetDB())
|
||||
})
|
||||
// api.GET("/players", func(c *gin.Context) {
|
||||
// player.GetPlayers(c, db.GetDB())
|
||||
// })
|
||||
api.GET("/players", auth.AuthorizeJWT("admin"), func(c *gin.Context) { player.GetPlayers(c, db.GetDB()) })
|
||||
|
||||
api.GET("/players/:id", func(c *gin.Context) {
|
||||
player.GetPlayer(c, db.GetDB(), c.Param("id"))
|
||||
})
|
||||
@@ -72,7 +74,7 @@ func main() {
|
||||
// c.JSON(http.StatusOK, gin.H{"message": "Player deleted successfully"})
|
||||
})
|
||||
api.GET("/teams", func(c *gin.Context) {
|
||||
|
||||
|
||||
})
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
|
||||
Reference in New Issue
Block a user