Versie 1.0
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const CategoryRepository = require("../repositories/CategoryRepository");
|
||||
|
||||
|
||||
class CategoryService {
|
||||
|
||||
|
||||
getCategories() {
|
||||
|
||||
return CategoryRepository.getAll();
|
||||
|
||||
}
|
||||
|
||||
|
||||
getCategory(id) {
|
||||
|
||||
return CategoryRepository.findById(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
createCategory(data) {
|
||||
|
||||
return CategoryRepository.create(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
updateCategory(id, data) {
|
||||
|
||||
return CategoryRepository.update(id, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
categoryHasProducts(id) {
|
||||
|
||||
return CategoryRepository.hasProducts(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
deleteCategory(id) {
|
||||
|
||||
return CategoryRepository.delete(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports = new CategoryService();
|
||||
Reference in New Issue
Block a user