The EAN Query Microservice is designed to provide product details based on the European Article Number (EAN) code associated with Supplier products. This service exposes a REST API that allows users to query product data, including basic product information, supplier details, and destination information.
EANs follow the format PPPPPPP+NNNNN+D, where:
- PPPPPPP refers to the supplier.
- NNNNN refers to the product code.
- D refers to the destination digit.
- The last digit of the EAN determines the destination of the product:
- 1-5: Supplier's stores in Spain.
- 6: Supplier's stores in Portugal.
- 8: Warehouses.
- 9: Supplier's Offices.
- 0: Beehives.
- EANs are composed of 13 numeric digits.
- The supplier can be identified by the Hacendado number (8437008) or another supplier's number.
The project is built using Spring Boot and utilizes H2 database for data storage. Swagger is integrated for API documentation, and Liquibase is used for pre-configuring the database. Additionally, integration and unit tests have been implemented to ensure code quality and functionality.
- Java Development Kit (JDK) Version: 17
- Apache Maven Version: 3.11.0
- Spring Boot Starter Web Version: 3.1.4
- Spring Security Test Version: 3.1.4
- Spring Boot Starter Data JPA Version: 3.1.4
- Spring Boot Starter Validation Version: 3.1.4
- Hibernate Validator Version: 8.0.1.Final
- H2 Database:
- Liquibase Version: 4.20.0
- Apache Tomcat Version: 9.0.78
- JSON Web Token (JWT)
- MapStruct Version: 1.5.5.Final
- Project Lombok Version: 4.20.0
Login: POST /api/auth/login
Summary: Login an existing user
Description: Allows existing users to log in to the system.
Registration: POST /api/auth/registration
Summary: Register a new user
Description: Enables new users to register and create an account in the system.
Find by EAN: GET /api/eans/{ean}
Summary: Find the information by EAN code
Description: Retrieves product information based on the provided EAN code.
Find by ID: GET /api/products/{id}
Summary: Find the product by ID
Description: Retrieves product details based on the specified ID.
Find by Code: GET /api/products/code/{code}
Summary: Find the product by code
Description: Retrieves product details based on the specified product code.
Get all products: GET /api/products
Summary: Get all products
Description: Retrieves a list of all available products.
Delete by ID: DELETE /api/products/{id}
Summary: Delete the product by ID
Description: Deletes a product from the system based on the specified ID.
Update by ID: PATCH /api/products/{id}
Summary: Update the product by ID
Description: Updates the product details based on the specified ID and parameters.
Create new product: POST /api/products
Summary: Create a new product
Description: Adds a new product to the system.
Find by ID: GET /api/suppliers/{id}
Summary: Find a supplier by ID
Description: Retrieves supplier details based on the specified ID.
Find by Code: GET /api/suppliers/code/{code}
Summary: Find a supplier by code
Description: Retrieves supplier details based on the specified supplier code.
Get all suppliers: GET /api/suppliers
Summary: Get all suppliers
Description: Retrieves a list of all available suppliers.
Delete by ID: DELETE /api/suppliers/{id}
Summary: Delete the supplier by ID
Description: Deletes a supplier from the system based on the specified ID.
Update by ID: PATCH /api/suppliers/{id}
Summary: Update the supplier by ID
Description: Updates the supplier details based on the specified ID and parameters.
Create new supplier: POST /api/suppliers
Summary: Create a new supplier
Description: Adds a new supplier to the system.
1. For use the application you do not need to have MySQL DB installed, it works with H2 DB.
2. Clone the repository.
3. Use IDE to build and run an application.
4. Use Postman and/or Swagger to work with the application.
API runs on port 8080
Swagger will be available by URL:
http://localhost:8080/swagger-ui/index.html#/
It provides detailed information about the available endpoints, request parameters, and response formats.
Please feel free to check all the functionality using Swagger!
Also, you will be able to work with the application by using Postman.
Users:
admin@gmail.com / 1234
user@gmail.com / 1234
Suppliers:
Supplier with number: 8437008
Supplier with number: 8480000
Supplier with number: 8484884
Products:
Product with number: 45905
Product with number: 16007
Product with number: 12345
Destination model with ENAM:
SupplierSpain (Set.of(1,2,3,4,5))
SupplierPortugal (Set.of(6))
Warehouses (Set.of(8))
SupplierOffices (Set.of(9))
Colmenas (Set.of(0))
Here is a list of the Postman request collections you can work with:
EAN.postman_collection.json