📦📦

Product Service

Use Case

Product Creation:
When a new product needs to be added, the Product Service receives the Name, Description, Price, and initial QuantityAvailable.
The Product Service generates a unique ID for the product.
It stores the product's ID, Name, Description, Price, and QuantityAvailable in MongoDB.
Product Update:
The Product Service allows for updating product information, such as modifying the Name, Description, Price, or adjusting the QuantityAvailable.
When a modification request is received, the Product Service retrieves the product record from MongoDB based on the product's ID.
It applies the requested changes to the corresponding fields in the product record and updates the data in MongoDB.
Product Retrieval:
The Product Service provides methods to retrieve product information based on various criteria, such as the product's ID or searching by name.
When a retrieval request is received, the Product Service queries MongoDB using the specified criteria.
It retrieves the relevant product records and returns the requested product information, including details such as ID, Name, Description, Price, and QuantityAvailable.
Inventory Management:
The Product Service tracks the available quantity of each product as part of its inventory management.
When an order is placed or an item is sold, the Product Service updates the QuantityAvailable field for the corresponding product in MongoDB, reflecting the updated inventory status.

Data Structure

Product:
ID (int)
Name (string)
Description (string)
Price (float)
QuantityAvailable (int)