feat(tags): this adds support for post, link, book, show and movie tags with a tag list view and per tag pages

This commit is contained in:
Cory Dransfeldt 2025-04-16 18:59:47 -07:00
parent 3d866262ca
commit 6fdc0b56b9
No known key found for this signature in database
35 changed files with 500 additions and 70 deletions

View file

@ -0,0 +1,38 @@
CREATE OR REPLACE FUNCTION get_tagged_content(
tag_query TEXT,
page_size INTEGER DEFAULT 20,
page_offset INTEGER DEFAULT 0
)
RETURNS TABLE (
tag TEXT,
title TEXT,
url TEXT,
content_date TIMESTAMP,
author JSON,
rating TEXT,
featured BOOLEAN,
tags TEXT[],
type TEXT,
label TEXT,
total_count BIGINT
) AS $$
BEGIN
RETURN QUERY
SELECT
t.tag,
t.title,
t.url,
t.content_date,
t.author,
t.rating,
t.featured,
t.tags,
t.type,
t.label,
COUNT(*) OVER() AS total_count
FROM optimized_tagged_content t
WHERE LOWER(TRIM(t.tag)) = LOWER(TRIM(tag_query))
ORDER BY content_date DESC NULLS LAST
LIMIT page_size OFFSET page_offset;
END;
$$ LANGUAGE plpgsql STABLE;