fix: jsonb tag filter operator ?? -> ?

This commit is contained in:
Alexey Pavlov
2026-05-31 16:38:48 +03:00
parent 3372574b32
commit c1d5337680
+1 -1
View File
@@ -35,7 +35,7 @@ async function listArticles({ limit = 20, offset = 0, tag = null, category = nul
let sql = `SELECT id, slug, title, excerpt, cover_url, tags, category, author, reading_time, published_at let sql = `SELECT id, slug, title, excerpt, cover_url, tags, category, author, reading_time, published_at
FROM articles WHERE status='published'`; FROM articles WHERE status='published'`;
const params = []; const params = [];
if (tag) { sql += ` AND tags ?? ${params.length + 1}`; params.push(tag); } if (tag) { sql += ` AND tags ? ${params.length + 1}`; params.push(tag); }
if (category) { sql += ` AND category=${params.length + 1}`; params.push(category); } if (category) { sql += ` AND category=${params.length + 1}`; params.push(category); }
sql += ` ORDER BY published_at DESC LIMIT $${params.length + 1} OFFSET $${params.length + 2}`; sql += ` ORDER BY published_at DESC LIMIT $${params.length + 1} OFFSET $${params.length + 2}`;
params.push(limit, offset); params.push(limit, offset);