veza/veza-backend-api/internal/api/routes_cloud.go
senke ec4564fb37 feat(v0.501): Sprint 3 -- Cloud Storage MVP backend
- C1-01: Create CloudService with CRUD folders/files, quota, ownership
- C1-02: Create CloudHandler with 11 REST endpoints
- C1-03: Register cloud routes in Go router
- C1-04: Implement file streaming with HTTP Range support
- C1-05: Add publish cloud file as track endpoint
- C1-06: Add MSW mock handlers for cloud API
- C1-07: Auto-init 5GB storage quota on user registration
- C1-08: Add 12 unit tests for CloudService
2026-02-22 18:23:58 +01:00

37 lines
1.2 KiB
Go

package api
import (
"github.com/gin-gonic/gin"
"veza-backend-api/internal/handlers"
"veza-backend-api/internal/services"
)
// setupCloudRoutes configure les routes Cloud Storage (v0.501 C1)
func (r *APIRouter) setupCloudRoutes(router *gin.RouterGroup) {
if r.config == nil || r.config.AuthMiddleware == nil {
return
}
cloudService := services.NewCloudService(r.db.GormDB, r.logger, r.config.S3StorageService)
cloudHandler := handlers.NewCloudHandler(cloudService, r.logger)
cloud := router.Group("/cloud")
cloud.Use(r.config.AuthMiddleware.RequireAuth())
r.applyCSRFProtection(cloud)
{
cloud.GET("/folders", cloudHandler.ListFolders)
cloud.POST("/folders", cloudHandler.CreateFolder)
cloud.PUT("/folders/:id", cloudHandler.RenameFolder)
cloud.DELETE("/folders/:id", cloudHandler.DeleteFolder)
cloud.GET("/files", cloudHandler.ListFiles)
cloud.POST("/files", cloudHandler.UploadFile)
cloud.GET("/files/:id", cloudHandler.GetFile)
cloud.DELETE("/files/:id", cloudHandler.DeleteFile)
cloud.GET("/files/:id/stream", cloudHandler.StreamFile)
cloud.POST("/files/:id/publish", cloudHandler.PublishAsTrack)
cloud.GET("/quota", cloudHandler.GetQuota)
}
}