53 lines
1.8 KiB
Rust
53 lines
1.8 KiB
Rust
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use derive_builder::Builder;
|
|
use mockall::predicate::*;
|
|
use mockall::*;
|
|
|
|
pub mod errors;
|
|
|
|
// services
|
|
pub mod add_category_service;
|
|
pub mod add_customization_service;
|
|
pub mod add_product_service;
|
|
pub mod add_store_service;
|
|
pub mod update_product_service;
|
|
|
|
#[automock]
|
|
pub trait InventoryServicesInterface: Send + Sync {
|
|
fn add_store(&self) -> add_store_service::AddStoreServiceObj;
|
|
fn add_category(&self) -> add_category_service::AddCategoryServiceObj;
|
|
fn add_product(&self) -> add_product_service::AddProductServiceObj;
|
|
fn add_customization(&self) -> add_customization_service::AddCustomizationServiceObj;
|
|
fn update_product(&self) -> update_product_service::UpdateProductServiceObj;
|
|
}
|
|
|
|
#[derive(Clone, Builder)]
|
|
pub struct InventoryServices {
|
|
add_store: add_store_service::AddStoreServiceObj,
|
|
add_category: add_category_service::AddCategoryServiceObj,
|
|
add_product: add_product_service::AddProductServiceObj,
|
|
add_customization: add_customization_service::AddCustomizationServiceObj,
|
|
update_product: update_product_service::UpdateProductServiceObj,
|
|
}
|
|
|
|
impl InventoryServicesInterface for InventoryServices {
|
|
fn add_store(&self) -> add_store_service::AddStoreServiceObj {
|
|
self.add_store.clone()
|
|
}
|
|
fn add_category(&self) -> add_category_service::AddCategoryServiceObj {
|
|
self.add_category.clone()
|
|
}
|
|
fn add_product(&self) -> add_product_service::AddProductServiceObj {
|
|
self.add_product.clone()
|
|
}
|
|
|
|
fn add_customization(&self) -> add_customization_service::AddCustomizationServiceObj {
|
|
self.add_customization.clone()
|
|
}
|
|
fn update_product(&self) -> update_product_service::UpdateProductServiceObj {
|
|
self.update_product().clone()
|
|
}
|
|
}
|