This backend service provides APIs for managing employees, products, and sale orders in the KiranaStore application.
Ensure that you have the following prerequisites installed on your system:
- Java 11 or later
- Maven
- SpringBoot
- Clone the repository:
git clone https://github.com/GoutamVerma/Backend-KiranaStore
- Navigate to the project directory:
cd Backend-KiranaStore
- Open the
src/main/resources/application.properties
file and configure your own database settings:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://your-mysql-host:your-mysql-port/your-database-name
spring.datasource.username=your-username
spring.datasource.password=your-password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
- Run the application using Maven:
mvn spring-boot:run
- Before accessing any API, generate data in tables for employees and products. After that, make sale orders using the provided API endpoints.
The server will start at localhost:8080
, and you can access the API endpoints as described below.
- Endpoint:
/admin/employee/add
- Method:
POST
- Request Parameters:
name
: Employee nameaddress
: Employee addressdesignation
: Employee designation
- Example Request:
curl -X POST http://localhost:8080/admin/employee/add \ -d "name=John Doe" \ -d "address=123 Main St" \ -d "designation=Manager"
- Endpoint:
/admin/employee/all_employee
- Method:
GET
- Example Request:
curl http://localhost:8080/admin/employee/all_employee
- Endpoint:
/product/order
- Method:
POST
- Request Parameters:
- ID: Product ID
- name: Product name
- category: Product category
- qty: Quantity
- unitPrice: Unit price
- currencyType: Currency type
- Example Request:
curl -X POST http://localhost:8080/product/order \ -d "ID=1" \ -d "name=Product A" \ -d "category=Electronics" \ -d "qty=10" \ -d "unitPrice=50.0" \ -d "currencyType=USD"
- Endpoint:
/product/all
- Method:
GET
- Example Request:
curl http://localhost:8080/product/all
- Endpoint:
/product/filter
- Method:
GET
- Request Parameters (Optional):
- category: Product category
- id: Product ID
- productName: Product name
- currencyType: Currency type
- Example Request:
curl http://localhost:8080/product/filter?id=1
- Endpoint:
/sale/createOrder
- Method:
POST
- Example Request:
curl -X POST \
http://localhost:8080/sale/createOrder \
-H 'Content-Type: application/json' \
-d '{
"empId": 123,
"customerName": "John Doe",
"currencyType": "USD",
"productQuantities": {
"1": 3,
"2": 2,
"3": 1
}
}'
- Endpoint:
/sale/all
- Method:
GET
- Example Request:
curl http://localhost:8080/sale/all
- Endpoint:
/sale/filter
- Method:
GET
- Request Parameters (Optional):
- orderId: Sale order ID
- currencyType: Currency type
- customerName: Customer name
- empId: Employee ID
- Example Request:
curl http://localhost:8080/sale/filter?orderId=1