veza/veza-backend-api/internal/api/routes_gear.go
senke edde637c8e feat(v0.501): Sprint 4 -- Cloud frontend + Gear advanced
- C1-09: Create CloudPage with folder tree, file list, and /cloud route
- C1-10: Create CloudUploadModal with drag-and-drop and progress
- C1-11: Create CloudFilePreview mini player inline
- C1-12: Add Cloud stories (loading, empty, populated, quota full)
- G1-01: Add is_public toggle, public gear endpoint, GearShowcase
- G1-02: Add gear image upload endpoints, GearImageGallery component
- G1-03: Add gear search with ILIKE + SearchBar in toolbar
- G1-04: Add stories for GearShowcase and GearImageGallery
2026-02-22 18:30:49 +01:00

35 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)
router.GET("/users/:username/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)
}
}