ADD: create a new category logic
This commit is contained in:
@@ -4,3 +4,8 @@ const AppError = require('../../globalErrorHandler/AppError')
|
|||||||
module.exports.getAllCategories = async () => {
|
module.exports.getAllCategories = async () => {
|
||||||
return Category.find().populate('parentId')
|
return Category.find().populate('parentId')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.createCategory = async (data) => {
|
||||||
|
const category = Category.create(data, null)
|
||||||
|
return category
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user