diff --git a/components/category/categoryController.js b/components/category/categoryController.js index e26323e..6aef053 100644 --- a/components/category/categoryController.js +++ b/components/category/categoryController.js @@ -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()