diff --git a/components/category/categoryService.js b/components/category/categoryService.js index dc773f4..fd37141 100644 --- a/components/category/categoryService.js +++ b/components/category/categoryService.js @@ -9,3 +9,13 @@ module.exports.createCategory = async (data) => { const category = Category.create(data, null) return category } + +module.exports.getCategory = async (categoryId) => { + const category = await Category.findById(categoryId) + + if (!category) { + throw new AppError('NoCategoryFound', 404, {}) + } + + return category +}