veza/veza-backend-api/internal/api/routes_distribution.go
senke 73eca4f6ad feat: backend, stream server & infra improvements
Backend (Go):
- Config: CORS, RabbitMQ, rate limit, main config updates
- Routes: core, distribution, tracks routing changes
- Middleware: rate limiter, endpoint limiter, response cache hardening
- Handlers: distribution, search handler fixes
- Workers: job worker improvements
- Upload validator and logging config additions
- New migrations: products, orders, performance indexes
- Seed tooling and data

Stream Server (Rust):
- Audio processing, config, routes, simple stream server updates
- Dockerfile improvements

Infrastructure:
- docker-compose.yml updates
- nginx-rtmp config changes
- Makefile improvements (config, dev, high, infra)
- Root package.json and lock file updates
- .env.example updates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:36:06 +01:00

41 lines
1.4 KiB
Go

package api
import (
"github.com/gin-gonic/gin"
"veza-backend-api/internal/core/distribution"
"veza-backend-api/internal/core/subscription"
"veza-backend-api/internal/handlers"
)
// setupDistributionRoutes configures routes for track distribution to external platforms (v0.12.2)
func (r *APIRouter) setupDistributionRoutes(router *gin.RouterGroup) {
subSvc := subscription.NewService(r.db.GormDB, r.logger)
svc := distribution.NewService(r.db.GormDB, r.logger, subSvc)
handler := handlers.NewDistributionHandler(svc, r.logger)
if r.config.AuthMiddleware == nil {
return
}
// Distribution management (requires auth)
distGroup := router.Group("/distributions")
distGroup.Use(r.config.AuthMiddleware.RequireAuth())
r.applyCSRFProtection(distGroup)
distGroup.POST("/submit", handler.Submit)
distGroup.GET("", handler.ListDistributions)
distGroup.GET("/:id", handler.GetDistribution)
distGroup.GET("/:id/status-history", handler.GetStatusHistory)
distGroup.POST("/:id/remove", handler.RemoveDistribution)
// Track-specific distribution view
trackDistGroup := router.Group("/tracks")
trackDistGroup.Use(r.config.AuthMiddleware.RequireAuth())
trackDistGroup.GET("/:id/distributions", handler.GetTrackDistributions)
// External royalties (creator view)
creatorGroup := router.Group("/creators/me")
creatorGroup.Use(r.config.AuthMiddleware.RequireAuth())
creatorGroup.GET("/external-royalties", handler.GetExternalRoyalties)
}