veza/veza-backend-api/internal/api/routes_discover.go
senke 7259526d43
Some checks failed
Backend API CI / test-unit (push) Failing after 2s
Backend API CI / test-integration (push) Failing after 6s
Frontend CI / test (push) Failing after 4s
Storybook Audit / Build & audit Storybook (push) Failing after 3s
feat(v0.10.4): Playlists collaboratives - F136, F140, F141, F143, F145
Backend:
- F141: GET /discover/playlists/editorial for editorial playlists
- F143: GET /playlists/shared/:token (public, no auth)
- F145: POST /playlists/import (JSON), GET /playlists/:id/export/m3u
- F136: GET /playlists/favoris (creates Favoris playlist if needed)
- Repo: GetFavorisByUserID, service GetOrCreateFavorisPlaylist

Frontend:
- SharedPlaylistPage at /playlists/shared/:token (public route)
- Editorial playlists section in DiscoverPage
- Export M3U in ExportPlaylistButton dropdown
- Import JSON via ImportPlaylistButton (PlaylistListPage)
- Favoris sidebar link, FavorisRedirectPage, AddToFavorisButton on tracks

Roadmap: v0.10.4 marked DONE
2026-03-09 16:49:05 +01:00

32 lines
1.5 KiB
Go

package api
import (
"github.com/gin-gonic/gin"
discovercore "veza-backend-api/internal/core/discover"
)
// setupDiscoverRoutes configures discover endpoints (v0.10.1 F351-F355)
func (r *APIRouter) setupDiscoverRoutes(router *gin.RouterGroup) {
discoverService := discovercore.NewService(r.db.GormDB, r.logger)
discoverHandler := discovercore.NewHandler(discoverService)
// Public routes
router.GET("/discover/genres", discoverHandler.ListGenres)
router.GET("/discover/genre/:genre", discoverHandler.GetTracksByGenre)
router.GET("/discover/tag/:tag", discoverHandler.GetTracksByTag)
router.GET("/discover/playlists/editorial", discoverHandler.GetEditorialPlaylists) // v0.10.4 F141
// Auth-required: follow/unfollow
if r.config.AuthMiddleware != nil {
router.POST("/discover/genre/:genre/follow", r.config.AuthMiddleware.RequireAuth(), discoverHandler.FollowGenre)
router.DELETE("/discover/genre/:genre/follow", r.config.AuthMiddleware.RequireAuth(), discoverHandler.UnfollowGenre)
router.POST("/discover/tag/:tag/follow", r.config.AuthMiddleware.RequireAuth(), discoverHandler.FollowTag)
router.DELETE("/discover/tag/:tag/follow", r.config.AuthMiddleware.RequireAuth(), discoverHandler.UnfollowTag)
} else {
router.POST("/discover/genre/:genre/follow", discoverHandler.FollowGenre)
router.DELETE("/discover/genre/:genre/follow", discoverHandler.UnfollowGenre)
router.POST("/discover/tag/:tag/follow", discoverHandler.FollowTag)
router.DELETE("/discover/tag/:tag/follow", discoverHandler.UnfollowTag)
}
}