The Product Management API is a comprehensive system designed to manage products, categories, brands, and models for an auto parts sales company. It provides endpoints for CRUD operations on products, categories, brands, and models, with a clean and professional structure that follows best practices and design patterns.
- Manage Products, Categories, Brands, and Models
- Many-to-Many relationships between Products and Categories, Products and Brands
- RESTful API with detailed endpoints for each operation
- Error handling with custom exceptions and global exception handling
- Data validation using Hibernate Validator
- Swagger documentation for easy API testing and interaction
- Java 21
- Spring Boot 3.3.0
- Spring Data JPA
- Hibernate
- MySQL
- MapStruct
- Lombok
- Swagger
- Maven
- JDK 21
- Maven
- MySQL Database
-
Clone the repository:
git clone https://github.com/CarlosPuent/product-management-api.git cd product-management-api
-
Configure the MySQL database in
application.yml
:spring: datasource: url: jdbc:mysql://localhost:3306/your_database_name username: your_username password: your_password
-
Build and run the application:
mvn clean install mvn spring-boot:run
Swagger UI is available for easy testing and interaction with the API.
Endpoint: POST /api/products
Example Request URL:
http://localhost:8080/api/products
Example Request Body:
{
"name": "Oil Filter",
"description": "High quality engine oil filter.",
"price": 17.25,
"category_ids": [5],
"brand_ids": [4],
"models": [
{
"name": "Model A",
"description": "Description for Model A"
},
{
"name": "Model B",
"description": "Description for Model B"
},
{
"name": "Model C",
"description": "Description for Model C"
}
],
"status": "ACTIVE",
"code": "ELE004"
}
Endpoint: PUT /api/products/{id}
Example Request URL:
http://localhost:8080/api/products/12
{
"name": "Oil Filter",
"description": "High quality engine oil filter.",
"price": 17.25,
"category_ids": [5],
"brand_ids": [4],
"models": [
{
"name": "Model A",
"description": "Description for Model A"
},
{
"name": "Model B",
"description": "Description for Model B"
},
{
"name": "Model C",
"description": "Description for Model C"
}
],
"status": "ACTIVE",
"code": "ELE004"
}
Feel free to contribute to this project by opening issues and submitting pull requests. Please ensure that your changes are well-tested and follow the existing code style.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries or feedback, please contact Carlos Puent.