The application consists of 3 parts. Category, Subcategory and Product.
* Each category has a name and one or more subcategories.
* Each subcategory has a name, category, and one or more products.
* Each product has a name, price, stock quantity and a subcategory.
* If requests are received at the same time for the only product left in stock, only one request get successful response.
- Java 11
- Spring Boot
- Maven
- Hibernate
- Mapstruct
- SLF4J
- Junit
- Redis
- Docker
- Swagger
- H2
- Factory Pattern
- CQRS Pattern
Tech | Version |
---|---|
Java | 11.0.11 |
Maven | 3.8.1 |
Docker | 20.10.6 |
Redis | 3.2.100 |
docker-compose up -d --build
mvn clean install -Dspring.profiles.active=local
mvn --projects io.github.oguzhancevik:stock-management spring-boot:run -Dspring-boot.run.arguments="--spring.profiles.active=local"
API | Method | Description |
---|---|---|
/api/categories | GET | Returns categories |
/api/categories/{categoryId} | GET | Returns a specific category |
/api/categories | POST | Creates a new category |
/api/categories/{categoryId} | PUT | Updates a specific category |
/api/categories/{categoryId} | DELETE | Deletes a specific category |
/api/subcategories | GET | Returns sub categories |
/api/subcategories/{subCategoryId} | GET | Returns a specific sub category |
/api/subcategories | POST | Creates a new sub category |
/api/subcategories/{subCategoryId} | PUT | Updates a specific sub category |
/api/subcategories/{subCategoryId} | DELETE | Deletes a specific sub category |
/api/products | GET | Returns products |
/api/products/{productId} | GET | Returns a specific product |
/api/products/search/category/{categoryId} | GET | Returns products by category id |
/api/products/search/subcategory/{subCategoryId} | GET | Returns products by sub category id |
/api/products/search/name/{productName} | GET | Returns products by product name |
/api/products/search/price/?min=200&max=500 | GET | Returns products by price interval |
/api/shopping-cart | POST | Returns successful / unsuccessful purchase result |
http://localhost:8080/swagger-ui/
Distributed under the MIT License. See LICENSE for more information.