- Java Development Kit (JDK): Ensure you have JDK installed.
- Maven: Ensure Maven is installed on your machine.
- Git: Clone the repository using the following command: git clone
- Navigate to Project Directory: cd path/to/directory/with/pom.xml
- Build the Project, Run Tests: mvn clean install
- Start the Application: mvn spring-boot:run
- Generate JaCoCo report: mvn clean install then go to target/site/index.html in your project directory
- URL: http://localhost:8080/h2-console
- Default JDBC URL:
jdbc:h2:mem:testdb(Check yourapplication.propertiesto confirm) - Username:
intern - Password: (Leave blank if not configured)
- POST
localhost:8080/api/products - Sample Request Body:
{
"name": "coffee machine",
"description": "Makes great coffee",
"currency": "USD",
"regularPrice": 15.0
}-GET localhost:8080/api/products
-PUT localhost:8080/api/products/{productId}
-Sample Request Body:
{
"name": "coffee machine",
"description": "test",
"regularPrice": 1,
"currency": "EUR"
}-POST localhost:8080/api/promo-code
-Sample request body :
{
"code": "TEST",
"expirationDate": "2024-05-14",
"discountValue": 5.0,
"currency": "USD",
"maxUsages": 15.0
}-NOTE: If you want the code to be valid until 13.05.2024 23:59 always provide the next day (14.05.2024)
-GET localhost:8080/api/promo-code
-GET localhost:8080/api/promo-code/{CODE}
-POST localhost:8080/api/discount
-Sample query:
{
"productId": 1,
"code": "TEST"
}-POST localhost:8080/api/purchase
-Sample query:
{
"productId": 1,
"code": "TEST"
}-GET localhost:8080/api/sales-report