chore: search cleanup
This commit is contained in:
parent
19d17f70d2
commit
fca18da3f7
36 changed files with 71 additions and 60 deletions
22
queries/views/media/music/three-month/albums.psql
Normal file
22
queries/views/media/music/three-month/albums.psql
Normal file
|
@ -0,0 +1,22 @@
|
|||
CREATE OR REPLACE VIEW three_month_albums AS
|
||||
SELECT
|
||||
ol.album_name,
|
||||
ol.artist_name,
|
||||
COUNT(*) AS plays,
|
||||
ol.album_art,
|
||||
ol.artist_url,
|
||||
json_build_object(
|
||||
'title', ol.album_name,
|
||||
'image', ol.album_art,
|
||||
'url', ol.artist_url,
|
||||
'alt', CONCAT(ol.album_name, ' by ', ol.artist_name),
|
||||
'subtext', ol.artist_name
|
||||
) AS grid
|
||||
FROM
|
||||
optimized_listens ol
|
||||
WHERE
|
||||
TO_TIMESTAMP(ol.listened_at) >= NOW() - INTERVAL '3 months'
|
||||
GROUP BY
|
||||
ol.album_name, ol.artist_name, ol.album_art, ol.artist_url
|
||||
ORDER BY
|
||||
plays DESC;
|
Reference in a new issue