Skip to content

Commit

Permalink
Merge 611c37b into ed97599
Browse files Browse the repository at this point in the history
  • Loading branch information
gbenziv authored Jan 16, 2021
2 parents ed97599 + 611c37b commit 1c1f69a
Show file tree
Hide file tree
Showing 28 changed files with 584 additions and 168 deletions.
6 changes: 3 additions & 3 deletions core/domain/common/basecontroller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class BaseController {
virtual ~BaseController() = default;

protected:
/*!
* Logs the validation results for debugging purposes
*/
/**
* Logs the validation results for debugging purposes
*/
typedef std::map<std::string, std::string> ValidationErrors;
void dumpValidationResult(const ValidationErrors& errors) const {
LOG_DEBUG("Dumping validation result");
Expand Down
62 changes: 31 additions & 31 deletions core/domain/common/cachecontroller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,78 +26,78 @@

namespace domain {

/*!
* Cache list wrapper
*/
/**
* Cache list wrapper
*/

template <typename EntityType>
class CacheController {
public:
CacheController() = default;
virtual ~CacheController() = default;

/*!
* Sets cached data
*/
/**
* Sets cached data
*/
void fill(const std::vector<EntityType>& list) {
mCachedList = list;
}

/*!
* Returns a copy of cached data
*/
/**
* Returns a copy of cached data
*/
const std::vector<EntityType>& get() {
return mCachedList;
}

/*!
* Adds data to the list
*/
/**
* Adds data to the list
*/
void insert(const EntityType& data) {
mCachedList.emplace_back(data);
}

/*!
* Removes data to the list
*/
/**
* Removes data to the list
*/
void erase(const typename std::vector<EntityType>::iterator it) {
mCachedList.erase(it);
}

/*!
* Checks if cache list is not empty
*/
/**
* Checks if cache list is not empty
*/
bool hasData() {
return !mCachedList.empty();
}

/*!
* Returns cache size
*/
/**
* Returns cache size
*/
size_t dataCount() {
return mCachedList.size();
}

/*!
* Returns an iterator referring to the past-the-end element in the cache list
*/
/**
* Returns an iterator referring to the past-the-end element in the cache list
*/
typename std::vector<EntityType>::iterator endOfData() {
return mCachedList.end();
}

/*!
* @param [in] 1 - the key or id string that you want to find
* @param [in] 2 - the entity function that returns their key or id (e.g. ID() or barcode())
*/
/**
* @param [in] 1 - the key or id string that you want to find
* @param [in] 2 - the entity function that returns their key or id (e.g. ID() or barcode())
*/
typename std::vector<EntityType>::iterator find(const std::string& key,
std::function<std::string(const EntityType&)> fn) {
return std::find_if(mCachedList.begin(), mCachedList.end(),
[&key, &fn](const EntityType& e) { return fn(e) == key; });
}

/*!
* See BaseController::find() for paramater details
*/
/**
* See BaseController::find() for paramater details
*/
bool isExists(const std::string& key, std::function<std::string(const EntityType&)> fn) {
return find(key, fn) != mCachedList.end();
}
Expand Down
24 changes: 12 additions & 12 deletions core/domain/customermgmt/interface/customermgmtdataif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ class CustomerManagementDataInterface {
CustomerManagementDataInterface() = default;
virtual ~CustomerManagementDataInterface() = default;

/*!
* Retrieves the all customers from the database
*/
/**
* Retrieves the all customers from the database
*/
virtual std::vector<entity::Customer> getCustomers() = 0;
/*!
* Create a customer
*/
/**
* Create a customer
*/
virtual void create(const entity::Customer& customer) = 0;
/*!
* Update a customer
*/
/**
* Update a customer
*/
virtual void update(const entity::Customer& customer) = 0;
/*!
* Removes the customer from the database
*/
/**
* Removes the customer from the database
*/
virtual void remove(const std::string& id) = 0;
};

Expand Down
34 changes: 17 additions & 17 deletions core/domain/customermgmt/interface/customermgmtiface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ class CustomerManagementControlInterface {
public:
CustomerManagementControlInterface() = default;
virtual ~CustomerManagementControlInterface() = default;
/*!
* Gets the list of all customers
*/
/**
* Gets the list of all customers
*/
virtual std::vector<entity::Customer> list() = 0;
/*!
* Retrieves a customer
*/
/**
* Retrieves a customer
*/
virtual entity::Customer get(const std::string& id) = 0;
/*!
* Used to create or update a customer
* - Creates the customer if the customerID does not exist in the database
* - Updates the customer using the customerID
* @param [in] - customer data
* @param [out] - validation result (map[field, error message])
/**
* Used to create or update a customer
* - Creates the customer if the customerID does not exist in the database
* - Updates the customer using the customerID
* @param [in] - customer data
* @param [out] - validation result (map[field, error message])
*
* Note: This will reset the map container
*/
* Note: This will reset the map container
*/
virtual CUSTOMERMGMTAPISTATUS save(const entity::Customer& customer,
std::map<std::string, std::string>* validationResult) = 0;
/*!
* Deletes a customer
*/
/**
* Deletes a customer
*/
virtual CUSTOMERMGMTAPISTATUS remove(const std::string& id) = 0;
};

Expand Down
18 changes: 9 additions & 9 deletions core/domain/customermgmt/interface/customermgmtviewif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ class CustomerManagementViewInterface {
CustomerManagementViewInterface() = default;
virtual ~CustomerManagementViewInterface() = default;

/*!
* show customer list is empty popup
*/
/**
* show customer list is empty popup
*/
virtual void showListIsEmptyPopup() = 0;
/*!
* showDataNotReadyScreen
*/
/**
* showDataNotReadyScreen
*/
virtual void showDataNotReadyScreen() = 0;
/*!
* showSuccessfullyRemoved
*/
/**
* showSuccessfullyRemoved
*/
virtual void showSuccessfullyRemoved(const std::string& customerName) = 0;
};

Expand Down
26 changes: 13 additions & 13 deletions core/domain/dashboard/interface/dashboarddataif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ class DashboardDataInterface {
public:
DashboardDataInterface() = default;
virtual ~DashboardDataInterface() = default;
/*!
* entity::User getUserByID(const std::string& userID)
* Looks for the user with userid
* Will return user->userID empty if user is not found.
/**
* entity::User getUserByID(const std::string& userID)
* Looks for the user with userid
* Will return user->userID empty if user is not found.
*
* [in] input userID
* [return] user entity
* [in] input userID
* [return] user entity
*/
virtual entity::User getUserByID(const std::string& userID) = 0;
/*!
* entity::Employee getEmployeeInformation(const std::string& employeeID)
* Used to retrieve the user information from employee database
* The employeeID parameter must be coming from getUserByID() API
/**
* entity::Employee getEmployeeInformation(const std::string& employeeID)
* Used to retrieve the user information from employee database
* The employeeID parameter must be coming from getUserByID() API
*
* [in] employeeID
* [return] employee entity
*/
* [in] employeeID
* [return] employee entity
*/
virtual entity::Employee getEmployeeInformation(const std::string& employeeID) = 0;
};

Expand Down
20 changes: 10 additions & 10 deletions core/domain/dashboard/interface/dashboardiface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ class DashboardControlInterface {
DashboardControlInterface() = default;
virtual ~DashboardControlInterface() = default;

/*!
* Sets the current user ID
* Warning: it is the caller's responsibility to provide a valid userID
/**
* Sets the current user ID
* Warning: it is the caller's responsibility to provide a valid userID
*/
virtual void setCurrentUserId(const std::string& userID) = 0;
/*!
* Returns the current user
* Note: Has to be paired with setCurrentUserId(); otherwise, will return empty
/**
* Returns the current user
* Note: Has to be paired with setCurrentUserId(); otherwise, will return empty
*/
virtual entity::User getCurrentUser() = 0;
/*!
* Returns more user information through the employee entity
* Note: Has to be paired with setCurrentUserId() and the user must have an employeeID;
* otherwise, will return empty.
/**
* Returns more user information through the employee entity
* Note: Has to be paired with setCurrentUserId() and the user must have an employeeID;
* otherwise, will return empty.
*/
virtual entity::Employee getUserDetails(const entity::User& user) = 0;
};
Expand Down
18 changes: 9 additions & 9 deletions core/domain/dashboard/interface/dashboardviewif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ class DashboardViewInterface {

// Public API

/*!
* showUserNotFound
*/
/**
* showUserNotFound
*/
virtual void showUserNotFound() = 0;
/*!
* showInvalidOptionPopup
*/
/**
* showInvalidOptionPopup
*/
virtual void showInvalidOptionPopup() = 0;
/*!
* showDataNotReadyScreen
*/
/**
* showDataNotReadyScreen
*/
virtual void showDataNotReadyScreen() = 0;
};

Expand Down
37 changes: 25 additions & 12 deletions core/domain/inventory/interface/inventorydataif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <string>
#include <vector>
#include <entity/product.hpp>
#include <entity/uom.hpp>

namespace domain {
namespace inventory {
Expand All @@ -32,22 +33,34 @@ class InventoryDataInterface {
InventoryDataInterface() = default;
virtual ~InventoryDataInterface() = default;

/*!
* Retrieves the all the products from the database
*/
/**
* Retrieves the all the products from the database
*/
virtual std::vector<entity::Product> getProducts() = 0;
/*!
* Create a product
*/
/**
* Create a product
*/
virtual void create(const entity::Product& product) = 0;
/*!
* Update a product
*/
/**
* Update a product
*/
virtual void update(const entity::Product& product) = 0;
/*!
* Removes the product from the database
*/
/**
* Removes the product from the database
*/
virtual void removeWithBarcode(const std::string& barcode) = 0;
/**
* Returns all the registered UOMs
*/
virtual std::vector<entity::UnitOfMeasurement> getUOMs() = 0;
/**
* Add a unit of measurement
*/
virtual void createUOM(const entity::UnitOfMeasurement& uom) = 0;
/**
* Remove a unit of measurement
*/
virtual void removeUOM(const std::string& id) = 0;
};

} // namespace inventory
Expand Down
Loading

0 comments on commit 1c1f69a

Please sign in to comment.