12 lines
327 B
JavaScript
12 lines
327 B
JavaScript
const Category = require('./categoryModel')
|
|
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
|
|
}
|