ADD: get one category logic
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user