This commit is contained in:
Tomáš Dvořák
2025-10-16 13:32:05 +02:00
commit 12cba639b9
663 changed files with 168914 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package routes
import (
"fotbal-club/internal/controllers"
"fotbal-club/internal/middleware"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
func RegisterEventRoutes(router *gin.RouterGroup, db *gorm.DB) {
eventController := controllers.EventController{DB: db}
events := router.Group("/events")
{
events.GET("", eventController.GetEvents)
events.GET("/upcoming", eventController.GetUpcomingEvents)
// Public single event endpoint
events.GET(":id", eventController.GetEventByID)
// Protected routes
authorized := events.Group("")
authorized.Use(middleware.JWTAuth(db))
{
authorized.POST("", eventController.CreateEvent)
authorized.PUT(":id", eventController.UpdateEvent)
authorized.DELETE(":id", eventController.DeleteEvent)
}
}
}