feat(db): add M6a home-section queries (recently added, most played, last played)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,3 +56,14 @@ LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountAlbumsMatching :one
|
||||
SELECT COUNT(*) FROM albums WHERE title ILIKE '%' || $1::text || '%';
|
||||
|
||||
-- name: ListRecentlyAddedAlbumsWithArtist :many
|
||||
-- M6a: recently-added albums joined with artist_name + artist_id for the
|
||||
-- home-page section. created_at is the row-insert timestamp from the
|
||||
-- scanner — the closest proxy to "added to library". Stable secondary
|
||||
-- ordering by id keeps pagination tie-break deterministic.
|
||||
SELECT sqlc.embed(albums), artists.name AS artist_name
|
||||
FROM albums
|
||||
JOIN artists ON artists.id = albums.artist_id
|
||||
ORDER BY albums.created_at DESC, albums.id
|
||||
LIMIT $1;
|
||||
|
||||
Reference in New Issue
Block a user