ADD: create a new category logic

This commit is contained in:
MohammadHMazarei
2024-12-29 19:50:59 +03:30
parent 183f458d93
commit 2fc9cad7fc
+5
View File
@@ -4,3 +4,8 @@ const AppError = require('../../globalErrorHandler/AppError')
module.exports.getAllCategories = async () => {
return Category.find().populate('parentId')
}
module.exports.createCategory = async (data) => {
const category = Category.create(data, null)
return category
}