chore: search cleanup
This commit is contained in:
parent
19d17f70d2
commit
fca18da3f7
36 changed files with 71 additions and 60 deletions
29
queries/views/media/music/recent-tracks.psql
Normal file
29
queries/views/media/music/recent-tracks.psql
Normal file
|
@ -0,0 +1,29 @@
|
|||
CREATE OR REPLACE VIEW recent_tracks AS
|
||||
SELECT
|
||||
ol.id,
|
||||
ol.listened_at,
|
||||
ol.track_name,
|
||||
ol.artist_name,
|
||||
ol.album_name,
|
||||
ol.album_key,
|
||||
ol.artist_art,
|
||||
ol.artist_genres,
|
||||
ol.genre_name,
|
||||
ol.artist_country,
|
||||
ol.album_art,
|
||||
ol.artist_url,
|
||||
ol.genre_url,
|
||||
json_build_object(
|
||||
'title', ol.track_name,
|
||||
'subtext', ol.artist_name,
|
||||
'alt', CONCAT(ol.track_name, ' by ', ol.artist_name),
|
||||
'url', ol.artist_url,
|
||||
'image', ol.album_art,
|
||||
'played_at', ol.listened_at
|
||||
) AS chart
|
||||
FROM
|
||||
optimized_listens ol
|
||||
WHERE
|
||||
TO_TIMESTAMP(ol.listened_at) >= NOW() - INTERVAL '7 days'
|
||||
ORDER BY
|
||||
TO_TIMESTAMP(ol.listened_at) DESC;
|
Reference in a new issue