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:
parent
3d866262ca
commit
6fdc0b56b9
35 changed files with 500 additions and 70 deletions
38
queries/functions/get_tagged_content.psql
Normal file
38
queries/functions/get_tagged_content.psql
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue