2026-03-10 18:54:26 +00:00
|
|
|
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())
|
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 10:36:06 +00:00
|
|
|
trackDistGroup.GET("/:id/distributions", handler.GetTrackDistributions)
|
2026-03-10 18:54:26 +00:00
|
|
|
|
|
|
|
|
// External royalties (creator view)
|
|
|
|
|
creatorGroup := router.Group("/creators/me")
|
|
|
|
|
creatorGroup.Use(r.config.AuthMiddleware.RequireAuth())
|
|
|
|
|
creatorGroup.GET("/external-royalties", handler.GetExternalRoyalties)
|
|
|
|
|
}
|