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();
|
||||
@@ -19,6 +19,41 @@ class ProductService {
|
||||
}
|
||||
|
||||
|
||||
createProducts(data) {
|
||||
|
||||
return ProductRepository.createMany(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
getProduct(id) {
|
||||
|
||||
return ProductRepository.findById(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
updateProduct(id, data) {
|
||||
|
||||
return ProductRepository.update(id, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
productHasListItems(id) {
|
||||
|
||||
return ProductRepository.hasListItems(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
deleteProduct(id) {
|
||||
|
||||
return ProductRepository.delete(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user