From 6e6c40920188b077a3f0ea41df84dc82bc7958a9 Mon Sep 17 00:00:00 2001 From: MohammadHMazarei Date: Sun, 29 Dec 2024 19:44:47 +0330 Subject: [PATCH] ADD: get all categories logic --- components/category/categoryService.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/category/categoryService.js b/components/category/categoryService.js index e69de29..a5b3552 100644 --- a/components/category/categoryService.js +++ b/components/category/categoryService.js @@ -0,0 +1,6 @@ +const Category = require('./categoryModel') +const AppError = require('../../globalErrorHandler/AppError') + +module.exports.getAllCategories = async () => { + return Category.find().populate('parentId') +}