Skip to content

Node.js based forum software built for the modern web

feat: expose calculateTopicPostCount and getChildrenTree

Barış Soner Uşaklı437424375ee5
diff --git a/src/categories/index.js b/src/categories/index.js
index 16113d8cc3..9480c936bb 100644
--- a/src/categories/index.js
+++ b/src/categories/index.js
@@ -188,6 +188,7 @@ function calculateTopicPostCount(category) {
category.totalPostCount = postCount;
category.totalTopicCount = topicCount;
}
+Categories.calculateTopicPostCount = calculateTopicPostCount;
Categories.getParents = async function (cids) {
const categoriesData = await Categories.getCategoriesFields(cids, ['parentCid']);
@@ -225,6 +226,8 @@ async function getChildrenTree(category, uid) {
Categories.getTree([category].concat(childrenData), category.parentCid);
}
+Categories.getChildrenTree = getChildrenTree;
+
Categories.getChildrenCids = async function (rootCid) {
let allCids = [];
async function recursive(keys) {