feat(server/playlists): manual For-You refresh endpoint
POST /api/playlists/system/for-you/refresh re-runs the system playlist build synchronously for the calling user, then returns the freshly-built For-You playlist's id, track count, and the track IDs in playlist position order. The frontend tile play button (next task) calls this endpoint on click and enqueues the returned track_ids directly — one roundtrip, no follow-up "list tracks" call needed for playback to start. Same authenticated-user-only posture as the Discover refresh from D-T3. Returns playlist_id=null and track_ids=[] when the build succeeded but the user's library yielded no eligible candidates (degenerate empty-library). Returns 500 on actual build failure. Tests cover 200 with shape (track_count matches len(track_ids)) and 401 without auth.
This commit is contained in:
@@ -137,6 +137,7 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, events *playev
|
||||
authed.Put("/playlists/{id}/tracks", h.handleReorderPlaylist)
|
||||
authed.Get("/playlists/{id}/cover", h.handleGetPlaylistCover)
|
||||
authed.Post("/playlists/system/discover/refresh", h.handleDiscoverRefresh)
|
||||
authed.Post("/playlists/system/for-you/refresh", h.handleForYouRefresh)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user