chore: align query count with template limit
This commit is contained in:
parent
ff3f538171
commit
d213d4380a
4 changed files with 19 additions and 5 deletions
|
@ -15,5 +15,6 @@ export default async function fetchSyndication() {
|
|||
}
|
||||
|
||||
const [{ feed } = {}] = data
|
||||
|
||||
return feed?.filter(item => item['feed'] !== null) || []
|
||||
}
|
|
@ -15,5 +15,6 @@ export default async function fetchSyndication() {
|
|||
}
|
||||
|
||||
const [{ syndication } = {}] = data
|
||||
|
||||
return syndication?.filter(item => item['syndication'] !== null) || []
|
||||
}
|
|
@ -22,14 +22,14 @@ WITH feed_data AS (
|
|||
SELECT
|
||||
l.date AS content_date,
|
||||
'link' AS content_type,
|
||||
CONCAT(l.title, ' via ', l.name) AS title,
|
||||
l.title,
|
||||
l.description,
|
||||
l.link AS url,
|
||||
NULL AS image,
|
||||
NULL AS rating,
|
||||
l.tags,
|
||||
json_build_object(
|
||||
'title', CONCAT(l.title, ' via ', l.name),
|
||||
'title', l.title,
|
||||
'url', l.link,
|
||||
'description', l.description,
|
||||
'date', l.date
|
||||
|
@ -86,4 +86,10 @@ WITH feed_data AS (
|
|||
)
|
||||
|
||||
SELECT json_agg(feed_data.* ORDER BY feed_data.content_date DESC) AS feed
|
||||
FROM feed_data;
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM feed_data
|
||||
WHERE feed IS NOT NULL
|
||||
ORDER BY content_date DESC
|
||||
LIMIT 20
|
||||
) AS feed_data;
|
|
@ -99,5 +99,11 @@ WITH syndication_data AS (
|
|||
FROM optimized_movies m
|
||||
)
|
||||
|
||||
SELECT json_agg(syndication_data.* ORDER BY syndication_data.content_date DESC) AS syndication
|
||||
FROM syndication_data;
|
||||
SELECT json_agg(limited_data.*) AS syndication
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM syndication_data
|
||||
WHERE syndication IS NOT NULL
|
||||
ORDER BY content_date DESC
|
||||
LIMIT 20
|
||||
) AS limited_data;
|
||||
|
|
Reference in a new issue