ADD: get category tree handler function
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
||||
const AppError = require('../../globalErrorHandler/AppError')
|
||||
const Category = require('./categoryModel')
|
||||
const categoryService = require('./categoryService')
|
||||
|
||||
exports.getCategoryTree = catchAsync(async (req, res, next) => {
|
||||
const categoryTree = await categoryService.getCategoryTree()
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: categoryTree,
|
||||
})
|
||||
})
|
||||
|
||||
exports.getAllCategories = catchAsync(async (req, res, next) => {
|
||||
const categories = await categoryService.getAllCategories()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user