Add more tag-related functions

This commit is contained in:
2020-12-22 16:46:57 -08:00
parent b99eb988ba
commit a925aa3bc3
+7 -3
View File
@@ -287,7 +287,7 @@ async function getCategories(db) {
return cats2
}
async function getTagCloud(db, limit) {
async function getTagCloud(db, limit, offset=0) {
const tags = db.prepare(`
SELECT count(t.id) as c, t.name
FROM article__tag a_t
@@ -296,7 +296,8 @@ async function getTagCloud(db, limit) {
GROUP BY t.id
ORDER BY c DESC
LIMIT @limit
`).all({ limit })
OFFSET @offset
`).all({ limit, offset })
return tags
}
@@ -444,5 +445,8 @@ module.exports = {
getArticleCounts,
getArticlesByYearMonth,
getArticlesByCategory,
countArticlesByCategory
countArticlesByCategory,
getArticlesByTag,
countArticlesByTag,
countTags
}