The Store Service handles store management, product stock, and product consumption across various stores. It is part of the organization's microservices architecture and provides APIs for managing stores and their stock and consumption details.
The Store Service provides functionality for:
- Creating and retrieving store information.
- Managing product stock and consumption.
- Retrieving product consumption data.
- Validating stock items.
- URL:
/store - Method:
POST - Description: Creates a new store.
- Request Body:
{ "name": "string", "location": "string" } - Response:
{ "id": "long", "name": "string", "location": "string" } - Response Code:
201 Created
- URL:
/store - Method:
GET - Description: Retrieves all stores.
- Response:
[ { "id": "long", "name": "string", "location": "string" } ] - Response Code:
200 OK
- URL:
/store/{id} - Method:
GET - Description: Retrieves details of a specific store by ID.
- Path Variable:
id(Long) - Response:
{ "id": "long", "name": "string", "location": "string" } - Response Code:
200 OK
- URL:
/store/{id}/product - Method:
GET - Description: Retrieves all products available at a specific store.
- Path Variable:
id(Long) - Response:
[ { "id": "long", "code": "string", "name": "string", "description": "string", "price": "double", "image": "string" } ] - Response Code:
200 OK
- URL:
/stock - Method:
POST - Description: Adds stock to the store for a specific product.
- Request Body:
{ "productId": "long", "storeId": "long", "quantity": "int" } - Response:
{ "id": "long", "productId": "long", "storeId": "long", "quantity": "int", "dateAdded": "string" } - Response Code:
201 Created
- URL:
/stock/validation - Method:
POST - Description: Validates the stock of multiple products.
- Request Body:
[ { "productId": "long", "storeId": "long", "quantity": "int" } ] - Response Code:
200 OK
- URL:
/stock/consumption - Method:
PUT - Description: Consumes stock for specific products in the store.
- Request Body:
[ { "productId": "long", "storeId": "long", "quantity": "int" } ] - Response Code:
200 OK
- URL:
/store/consumption - Method:
GET - Description: Retrieves all product consumptions across all stores.
- Response:
[ { "id": "long", "productId": "long", "store": { "id": "long", "name": "string", "location": "string" }, "quantityConsumed": "int", "dateConsumed": "datetime" } ] - Response Code:
200 OK
- URL:
/store/consumption?storeId={storeId} - Method:
GET - Description: Retrieves product consumption details for a specific store.
- Query Param:
storeId(Long) - Response:
[ { "id": "long", "productId": "long", "store": { "id": "long", "name": "string", "location": "string" }, "quantityConsumed": "int", "dateConsumed": "datetime" } ] - Response Code:
200 OK
- Configure the database connection in the
application.propertiesfile:spring.datasource.url=jdbc:mysql://localhost:3306/your_database_name spring.datasource.username=your_db_username spring.datasource.password=your_db_password