feat: improve feeds

This commit is contained in:
Cory Dransfeldt 2024-11-15 16:53:25 -08:00
parent a71e910482
commit 1d185fe7cd
No known key found for this signature in database
7 changed files with 62 additions and 46 deletions

View file

@ -78,7 +78,11 @@ json_build_object('title', CONCAT(b.title, ' by ', b.author), 'image', CONCAT('/
END) AS grid,
CASE WHEN LOWER(b.read_status) = 'finished'
AND b.star_rating IS NOT NULL THEN
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.slug), 'date', b.date_finished, 'description', b.description, 'image', CONCAT('/', df.filename_disk), 'rating', b.star_rating)
json_build_object('title', b.title, 'url', CONCAT('https://coryd.dev', b.slug), 'date', b.date_finished, 'description', CASE WHEN b.review IS NOT NULL THEN
b.review
ELSE
b.description
END, 'image', CONCAT('/', df.filename_disk), 'rating', b.star_rating)
ELSE
NULL
END AS feed

View file

@ -83,7 +83,11 @@ WHERE
r.movies_id = m.id) AS related_movies,
CASE WHEN m.star_rating IS NOT NULL
AND m.last_watched IS NOT NULL THEN
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.slug), 'date', m.last_watched, 'description', m.description, 'image', CONCAT('/', df.filename_disk), 'rating', m.star_rating)
json_build_object('title', m.title, 'url', CONCAT('https://coryd.dev', m.slug), 'date', m.last_watched, 'description', CASE WHEN m.review IS NOT NULL THEN
m.review
ELSE
m.description
END, 'image', CONCAT('/', df.filename_disk), 'rating', m.star_rating)
ELSE
NULL
END AS feed