diff --git a/plugins/nodebb-plugin-qa-students-filter/library.js b/plugins/nodebb-plugin-qa-students-filter/library.js new file mode 100644 index 0000000000..2ead0fea61 --- /dev/null +++ b/plugins/nodebb-plugin-qa-students-filter/library.js @@ -0,0 +1,16 @@ +const db = require('../database'); +const { getChildrenCids } = require('../../src/categories'); +const user = require('../user') +const plugin = {}; + +plugin.filterSubjectsByTrimester = async (cids, uid) => { + + const filteredCategories = []; + + for(const cid in cids){ + const allChildCids = await categories.getAllCidsFromSet("cid:${cid}:children"); + filteredCategories.concat(allChildCids); + } + + return filteredCategories; +} \ No newline at end of file diff --git a/plugins/nodebb-plugin-qa-students-filter/packages.json b/plugins/nodebb-plugin-qa-students-filter/packages.json new file mode 100644 index 0000000000..212407edec --- /dev/null +++ b/plugins/nodebb-plugin-qa-students-filter/packages.json @@ -0,0 +1,17 @@ +{ + "name": "nodebb-plugin-qa-students-filter", + "version": "1.0.0", + "description": " students filter plugin to Q&A for NodeBB", + "main": "library.js", + "keywords": [ + "nodebb", + "plugin", + "questions", + "answers" + ], + "license": "MIT", + "nbbpm": { + "compatibility": "^3.0.0" + } + } + \ No newline at end of file diff --git a/plugins/nodebb-plugin-qa-students-filter/plugin.json b/plugins/nodebb-plugin-qa-students-filter/plugin.json new file mode 100644 index 0000000000..25a087a0b2 --- /dev/null +++ b/plugins/nodebb-plugin-qa-students-filter/plugin.json @@ -0,0 +1,10 @@ +{ + "id": "nodebb-plugin-qa-students-filter", + "library": "./library.js", + "hooks": [ + { + "hook": "filter:trimester.filter", + "method": "filterSubjectsByTrimester" + } + ] +} \ No newline at end of file