-- T04: Check database for knowledge articles (v2_knowledge)
-- Run against your DB: mysql -u user -p your_db < docs/sql/check_knowledge_articles.sql
-- Or use API: GET /api/front/tool/knowledge/stats (returns total, byType, byStatus)
--
-- If (guide + article, published) counts are 0: run docs/sql/seed_v2_knowledge_guide_article.sql
-- If data exists but list click doesn't open detail: check front-end console for
--   [nutrition-knowledge] goToDetail logs (item keys, resolved id, navigate url).

SELECT 'v2_knowledge: total' AS report, COUNT(*) AS cnt FROM v2_knowledge;

SELECT type, status, COUNT(*) AS cnt
FROM v2_knowledge
GROUP BY type, status
ORDER BY type, status;

-- Published count by type (guide + article must be > 0 for list/click to work)
SELECT type, COUNT(*) AS cnt
FROM v2_knowledge
WHERE status = 'published'
GROUP BY type
ORDER BY type;
