Merge branch 'feature-inventory-management-inv002' into feature-inventory-management

This commit is contained in:
Avinash Rajesh
2026-05-21 20:09:53 +05:30
5 changed files with 141 additions and 0 deletions
@@ -1,4 +1,26 @@
#include "InventoryManagementService.h"
#include "InventoryItem.h"
#include "Factory.h"
void InventoryManagementService::addInventoryItem(const std::string& partName, int quantity, double price)
{
InventoryItem* newItem = Factory::getObject<InventoryItem>(partName, quantity, price);
m_dataStore.getInventoryItems().insert(newItem->getId(), newItem);
}
void InventoryManagementService::addInventoryItemStock(const std::string& selectedItemId, int quantity)
{
int index = m_dataStore.getInventoryItems().find(selectedItemId);
if (index != -1)
{
InventoryItem* item = m_dataStore.getInventoryItems().getValueAt(index);
if (item != nullptr)
{
int totalQuantity = item->getQuantity() + quantity;
item->setQuantity(totalQuantity);
}
}
}
util::Map<std::string, InventoryItem*> InventoryManagementService::getInventoryItems()
{
@@ -17,6 +17,7 @@ public:
InventoryItem* getInventoryItem(const std::string& inventoryItemID);
void addInventoryItem(const std::string& partName, int quantity, double price);
void removeInventoryItem(const std::string& inventoryItemID);
void addInventoryItemStock(const std::string& selectedItemId, int quantity);
void sendLowStockAlerts();
void sendNotification(User* user, const std::string& title, const std::string& message) override;
void attach(User* user) override;