diff --git a/components/category/categoryService.js b/components/category/categoryService.js index 505953e..ab548ce 100644 --- a/components/category/categoryService.js +++ b/components/category/categoryService.js @@ -29,3 +29,13 @@ module.exports.updateCategory = async (categoryId, data) => { return category } + +module.exports.deleteCategory = async (categoryId) => { + const category = await Category.findByIdAndDelete(categoryId) + + if (!category) { + throw new AppError('NoCategoryFound', 404, {}) + } + + return null +}