Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listAllCategories(categoryId = null)
- if(categoryId != null){
- rootCategory = CategoryModel.find({_id: categoryId})
- rootCategory.children = [];
- }
- categories = find (parent == categoriyId)
- categories.forEach(categorie => {
- knowledges = KnowledgeModel->find({category: categorie._id})
- categorie.knowledges = knowledges;
- categorie.children = listAllCategories(categorie._id);
- });
- return categories;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement