This Spring Boot project implements a pricing service for an e-commerce platform. It provides REST APIs to manage and retrieve pricing information based on product ID, brand ID, and application dates. The service utilizes an in-memory H2 database for storing pricing data, making it fast and efficient for development and testing purposes.
- Retrieve applicable prices based on product ID, brand ID, and date.
- List all available prices in the system.
- In-memory H2 database integration for quick setup and testing.
- Layered architecture following Domain-Driven Design (DDD) principles.
- Java 17
- Spring Boot - Server-side application framework.
- H2 Database - In-memory database.
- JPA / Hibernate - For ORM and database interaction.
- JUnit & Mockito - For unit and integration testing.
- Cucumber - For e2e testing.
- Maven - Dependency management and build tool.
- Get All Prices:
- Method: GET
- Endpoint: /api/v1/prices/all
- Description: Retrieves a list of all prices.
- Get Applicable Price:
- Method: GET
- Endpoint: /api/v1/prices/applicable
- Parameters:
- date - The date for which to find the price.
- productId - The ID of the product.
- brandId - The ID of the brand.
- Description: Retrieves the applicable price for a given product and brand on a specific date.
- Get Price:
- Method: GET
- Endpoint: /api/v1/prices/price
- Parameters:
- PriceResponseDto - Object with date, productId and brandId.
- Description: Retrieves the price for a given product and brand on a specific date.
Clone the Repository:
git clone https://github.com/Ferranv3/SpringBoot-DDD-Store.git
Navigate to the Project Directory:
cd SpringBoot-DDD-Store
Build the Project with Maven:
mvn clean install
Run the Application:
mvn spring-boot:run
Install Docker in your computer and build and run the app:
docker build -t store .
docker run -p 8080:8080 store
Run the following command to execute unit and integration tests:
mvn test
- Developer: Ferran Hernandez Prunera