feat: initial view queries

This commit is contained in:
Cory Dransfeldt 2024-10-12 13:07:26 -07:00
parent 8f44ce9bdd
commit 08e2c2ff3f
No known key found for this signature in database
23 changed files with 1282 additions and 10 deletions

View file

@ -0,0 +1,21 @@
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
FROM
optimized_listens ol
WHERE
TO_TIMESTAMP(ol.listened_at) >= NOW() - INTERVAL '7 days'
ORDER BY
TO_TIMESTAMP(ol.listened_at) DESC;