A RESTful API built with Spring Boot for managing product inventory and operations in a store environment.
- Register, update, delete and list products
- Data validation using custom exception handling
- H2 in-memory database support
- Swagger documentation via OpenAPI 3
- Java 21
- Spring Boot
- Spring Web
- Spring Data JPA
- H2 Database (dev/test)
- Docker
- Bean Validation (Jakarta Validation)
- Swagger / OpenAPI 3
- JUnit 5
- Mockito
Execute the following command to run unit tests:
./mvnw test| Method | Endpoint | Description |
|---|---|---|
| GET | /products |
Get all products |
| GET | /products/{id} |
Get a single product by ID |
| POST | /products |
Create a new product |
| PUT | /products/{id} |
Update an existing product by ID |
| DELETE | /products/{id} |
Delete a product by ID |
The API includes custom validation rules:
code: Must be exactly 6 integer digits
name: Only letters, numbers, spaces, and hyphens allowed
expiration date: Must match DD/MM/YYYY format and be valid (dates prior to the current day are not allowed)
address: We got two store address patterns: 17A-R5 and PAR-123 where:
On "17A-R5" example:
- 17 is the street number where the product is stored (can go from 1 to 20)
- A is the street side where the product is stored (can be A or B)
- Hyphen split the street info and the stored product position
- R points to the stored product position
- 5 it's the stored product position (can go from 1 to 6)
and "PAR-123":
- PAR means the product is stored in other stock, and it can go from 1 to ?
Custom exceptions are thrown if validations fail.
- Clone the repository:
git clone https://github.com/estevao081/mapAereo.git
cd mapAereo- Build and run the project using Maven:
./mvnw spring-boot:run- Access Swagger UI for API documentation:
http://localhost:8080/swagger-ui/index.html
This project is licensed under the MIT License.