feat(server/playlists): manual Discover refresh endpoint
POST /api/playlists/system/discover/refresh re-runs the system playlist build synchronously for the calling user, then returns their newly-built Discover playlist's UUID and track count. Used by the frontend's "Refresh" affordances (next task) on the Discover detail page header and the home Playlists row tile kebab. Operator's escape hatch when they want a different randomness without waiting for tomorrow's cron tick (e.g., after pasting a Last.fm key, after the daily cover-art enrichment expanded their playable library, or just for the heck of it). Authenticated user only; the authed sub-router's RequireUser middleware handles 401. Each user refreshes only their own Discover — no admin route, no cross-user impersonation. Adds GetSystemPlaylistByVariantForUser sqlc query for the response lookup. Returns playlist_id=null and track_count=0 if the build succeeded but the user's library yielded no eligible tracks (degenerate empty-library).
This commit is contained in:
@@ -136,6 +136,7 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, events *playev
|
||||
authed.Delete("/playlists/{id}/tracks/{position}", h.handleRemovePlaylistTrack)
|
||||
authed.Put("/playlists/{id}/tracks", h.handleReorderPlaylist)
|
||||
authed.Get("/playlists/{id}/cover", h.handleGetPlaylistCover)
|
||||
authed.Post("/playlists/system/discover/refresh", h.handleDiscoverRefresh)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user