- INT-01: Add E2E streaming tests (upload -> HLS auth) - INT-02: Add E2E cloud tests (CRUD auth, public gear) - INT-03: Split track/handler.go into 4 focused sub-handlers - INT-04: Create migration squash script + MIGRATIONS.md - INT-05: Add Trivy container image scanning CI workflow - INT-06: Replace production console.log with structured logger
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"veza-backend-api/internal/handlers"
|
|
"veza-backend-api/internal/repositories"
|
|
"veza-backend-api/internal/services"
|
|
)
|
|
|
|
// setupGearRoutes configure les routes d'inventaire gear/équipement
|
|
func (r *APIRouter) setupGearRoutes(router *gin.RouterGroup) {
|
|
if r.config == nil || r.config.AuthMiddleware == nil {
|
|
return
|
|
}
|
|
gearRepo := repositories.NewGearRepository(r.db.GormDB)
|
|
gearService := services.NewGearService(gearRepo, r.logger)
|
|
gearHandler := handlers.NewGearHandler(gearService, r.logger)
|
|
|
|
// G1-01: Public gear profile (no auth)
|
|
// Use :id to avoid Gin conflict with /users/:id/avatar (same path param name required)
|
|
router.GET("/users/:id/gear", gearHandler.ListPublicGear)
|
|
|
|
inventory := router.Group("/inventory")
|
|
inventory.Use(r.config.AuthMiddleware.RequireAuth())
|
|
r.applyCSRFProtection(inventory)
|
|
{
|
|
inventory.GET("/gear", gearHandler.ListGear)
|
|
inventory.POST("/gear", gearHandler.CreateGear)
|
|
inventory.GET("/gear/:id", gearHandler.GetGear)
|
|
inventory.PUT("/gear/:id", gearHandler.UpdateGear)
|
|
inventory.DELETE("/gear/:id", gearHandler.DeleteGear)
|
|
inventory.POST("/gear/:id/images", gearHandler.UploadGearImage)
|
|
inventory.DELETE("/gear/:id/images/:img_id", gearHandler.DeleteGearImage)
|
|
}
|
|
}
|