feat: initial view queries
This commit is contained in:
parent
8f44ce9bdd
commit
08e2c2ff3f
23 changed files with 1282 additions and 10 deletions
25
views/media/music/album-releases.psql
Normal file
25
views/media/music/album-releases.psql
Normal file
|
@ -0,0 +1,25 @@
|
|||
CREATE OR REPLACE VIEW optimized_album_releases AS
|
||||
SELECT
|
||||
a.name AS title,
|
||||
a.release_date,
|
||||
a.release_link AS url,
|
||||
a.total_plays,
|
||||
CONCAT('/', df.filename_disk) AS image,
|
||||
'album-release' AS type,
|
||||
|
||||
json_build_object(
|
||||
'name', ar.name_string,
|
||||
'url', ar.slug,
|
||||
'description', ar.description
|
||||
) AS artist,
|
||||
|
||||
EXTRACT(EPOCH FROM a.release_date) AS release_timestamp
|
||||
|
||||
FROM
|
||||
albums a
|
||||
LEFT JOIN
|
||||
directus_files df ON a.art = df.id
|
||||
LEFT JOIN
|
||||
artists ar ON a.artist = ar.id
|
||||
WHERE
|
||||
a.release_date IS NOT NULL;
|
Reference in a new issue