From 6ca659c5735c467a8d365bbf460cefb4783149b4 Mon Sep 17 00:00:00 2001 From: Avinash Rajesh Date: Fri, 22 May 2026 11:27:49 +0530 Subject: [PATCH] Add standardized documentation headers --- .../controllers/Controller.cpp | 49 ++++++++++++ .../controllers/Controller.h | 8 ++ .../services/InventoryManagementService.cpp | 42 ++++++++++ .../services/InventoryManagementService.h | 8 ++ .../views/AdminMenu.cpp | 76 ++++++++++++++++--- .../views/AdminMenu.h | 8 ++ 6 files changed, 182 insertions(+), 9 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp index 45c9c5f..21bc7de 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp @@ -1,5 +1,20 @@ +/* +File: Controller.cpp +Description: Implementation file containing the method definitions + of the Controller class, which manages user authentication, + inventory, services, bookings, and notifications. +Author: Trenser +Date:19-May-2026 +*/ #include "Controller.h" +/* +Function: login +Description: Authenticates a user based on provided credentials. +Parameter: const std::string& username - the username of the user + const std::string& password - the password of the user +Return type: bool +*/ bool Controller::login(const std::string& username, const std::string& password) { return false; @@ -48,6 +63,13 @@ void Controller::purchaseComboPackage(const std::string& comboPackageID, const s { } +/* +Function: getInventoryItems +Description: Retrieves all inventory items from the inventory management service + and constructs a read-only map for external use. +Parameter: None +Return type: util::Map +*/ util::Map Controller::getInventoryItems() { auto inventoryIems = m_inventoryManagementService.getInventoryItems(); @@ -60,21 +82,48 @@ util::Map Controller::getInventoryItems() return readOnlyInventoryItems; } +/* +Function: getInventoryItem +Description: Retrieves a specific inventory item by its ID from the inventory management service. +Parameter: const std::string& inventoryItemID - ID of the inventory item +Return type: const InventoryItem* +*/ const InventoryItem* Controller::getInventoryItem(const std::string& inventoryItemID) { return m_inventoryManagementService.getInventoryItem(inventoryItemID); } +/* +Function: addInventoryItem +Description: Adds a new inventory item with specified details to the inventory management service. +Parameter: const std::string& partName - name of the part + int quantity - quantity of the part + double price - price of the part +Return type: void +*/ void Controller::addInventoryItem(const std::string& partName, int quantity, double price) { m_inventoryManagementService.addInventoryItem(partName, quantity, price); } +/* +Function: removeInventoryItem +Description: Removes an inventory item from the inventory management service by its ID. +Parameter: const std::string& inventoryItemID - ID of the inventory item +Return type: void +*/ void Controller::removeInventoryItem(const std::string& inventoryItemID) { m_inventoryManagementService.removeInventoryItem(inventoryItemID); } +/* +Function: addInventoryItemStock +Description: Adds stock to an existing inventory item in the inventory management service. +Parameter: const std::string& selectedItemId - ID of the inventory item + int quantity - quantity to add +Return type: void +*/ void Controller::addInventoryItemStock(const std::string& selectedItemId, int quantity) { m_inventoryManagementService.addInventoryItemStock(selectedItemId, quantity); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h index 1d849de..47ebe1f 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h @@ -1,3 +1,11 @@ +/* +File: Controller.h +Description: Header file declaring the Controller class, which manages + user authentication, inventory, services, bookings, job cards, + invoices, and notifications in the system. +Author: Trenser +Date:19-May-2026 +*/ #pragma once #include "Map.h" #include diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp index 0cd72de..ef48930 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp @@ -1,13 +1,37 @@ +/* +File: InventoryManagementService.cpp +Description: Implementation file containing the method definitions of the + InventoryManagementService class, including inventory operations + and notification handling. +Author: Trenser +Date:19-May-2026 +*/ #include "InventoryManagementService.h" #include "InventoryItem.h" #include "Factory.h" +/* +Function: addInventoryItem +Description: Creates a new inventory item using the Factory and inserts it + into the DataStore. +Parameter: const std::string& partName - name of the part + int quantity - initial quantity of the part + double price - price of the part +Return type: void +*/ void InventoryManagementService::addInventoryItem(const std::string& partName, int quantity, double price) { InventoryItem* newItem = Factory::getObject(partName, quantity, price); m_dataStore.getInventoryItems().insert(newItem->getId(), newItem); } +/* +Function: addInventoryItemStock +Description: Increases the stock quantity of an existing inventory item. +Parameter: const std::string& selectedItemId - ID of the inventory item + int quantity - quantity to add +Return type: void +*/ void InventoryManagementService::addInventoryItemStock(const std::string& selectedItemId, int quantity) { int index = m_dataStore.getInventoryItems().find(selectedItemId); @@ -22,11 +46,23 @@ void InventoryManagementService::addInventoryItemStock(const std::string& select } } +/* +Function: getInventoryItems +Description: Retrieves all inventory items stored in the DataStore. +Parameter: None +Return type: util::Map +*/ util::Map InventoryManagementService::getInventoryItems() { return m_dataStore.getInventoryItems(); } +/* +Function: removeInventoryItem +Description: Marks an inventory item as inactive instead of deleting it. +Parameter: const std::string& inventoryItemID - ID of the inventory item +Return type: void +*/ void InventoryManagementService::removeInventoryItem(const std::string& inventoryItemID) { int index = m_dataStore.getInventoryItems().find(inventoryItemID); @@ -40,6 +76,12 @@ void InventoryManagementService::removeInventoryItem(const std::string& inventor } } +/* +Function: getInventoryItem +Description: Retrieves a specific inventory item by its ID from the DataStore. +Parameter: const std::string& inventoryItemID - ID of the inventory item +Return type: InventoryItem* +*/ InventoryItem* InventoryManagementService::getInventoryItem(const std::string& inventoryItemID) { int index = m_dataStore.getInventoryItems().find(inventoryItemID); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h index c27ba64..e7c549c 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h @@ -1,3 +1,11 @@ +/* +File: InventoryManagementService.h +Description: Header file declaring the InventoryManagementService class, + which manages inventory items, stock updates, and notifications + related to low stock alerts. Inherits from NotificationManagementService. +Author: Trenser +Date:19-May-2026 +*/ #pragma once #include #include "Map.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp index 87b9011..6b59088 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp @@ -1,10 +1,23 @@ +/* +File: AdminMenu.cpp +Description: Implementation file containing the method definitions of the + AdminMenu class, including menu handling, inventory operations, + and stock management functions. +Author: Trenser +Date:19-May-2026 +*/ #include #include "AdminMenu.h" #include "InventoryItem.h" #include "InputHelper.h" #include "OutputHelper.h" -#include "InventoryItem.h" +/* +Function: showMenu +Description: Displays the admin menu and handles user input until the menu is exited. +Parameter: None +Return type: void +*/ void AdminMenu::showMenu() { bool isMenuActive = true; @@ -43,6 +56,13 @@ void AdminMenu::changePassword() { } +/* +Function: viewStockLevels +Description: Displays all active inventory items with their details + including ID, part name, quantity, and price. +Parameter: None +Return type: void +*/ void AdminMenu::viewStockLevels() { auto inventoryItems = m_controller.getInventoryItems(); @@ -68,6 +88,14 @@ void AdminMenu::viewStockLevels() } } +/* +Function: filterActiveItems +Description: Filters out inactive inventory items and returns a map + containing only active items. +Parameter: const util::Map& inventoryItems - + map of all inventory items +Return type: util::Map +*/ static util::Map filterActiveItems(const util::Map& inventoryItems) { @@ -84,6 +112,14 @@ filterActiveItems(const util::Map& inventoryI return activeItems; } +/* +Function: displayInventoryWithItems +Description: Displays inventory items in a tabular format with index, ID, + part name, quantity, and price. +Parameter: util::Map& inventoryItems - + map of inventory items to display +Return type: void +*/ static void displayInventoryWithItems(util::Map& inventoryItems) { int inventorySize = inventoryItems.getSize(); @@ -108,6 +144,15 @@ static void displayInventoryWithItems(util::Map& inventoryItems - + map of inventory items + Controller& m_controller - controller instance to update stock +Return type: void +*/ static void addQuantityToItem(util::Map& inventoryItems, Controller& m_controller) { int itemIndex; @@ -149,6 +194,13 @@ static void addQuantityToItem(util::Map& inve } } +/* +Function: addInventoryItem +Description: Allows the admin to either add a new inventory item + or increase the quantity of an existing item. +Parameter: None +Return type: void +*/ void AdminMenu::addInventoryItem() { util::clear(); @@ -182,14 +234,13 @@ void AdminMenu::addInventoryItem() util::pressEnter(); } -static util::Map -filterActiveItems(const util::Map& inventoryItems) -{ } - -static void displayInventoryWithItems(util::Map& inventoryItems) -{ -} - +/* +Function: removeInventoryItem +Description: Removes an active inventory item by marking it inactive + after user selection. +Parameter: None +Return type: void +*/ void AdminMenu::removeInventoryItem() { util::clear(); @@ -225,6 +276,13 @@ void AdminMenu::removeInventoryItem() util::pressEnter(); } +/* +Function: checkStockAvailability +Description: Checks if a specific inventory item is available + and displays its details if active. +Parameter: None +Return type: void +*/ void AdminMenu::checkStockAvailability() { util::clear(); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h index 05fdd84..d65b720 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h @@ -1,3 +1,11 @@ +/* +File: AdminMenu.h +Description: Header file declaring the AdminMenu class, which provides + administrative operations such as inventory management, + user management, service configuration, and notifications. +Author: Trenser +Date:19-May-2026 +*/ #pragma once #include "Controller.h"