This project is a Spring Boot application for inventory management. It includes features for managing suppliers, stocks, orders, and order items. The application also incorporates security measures to restrict unauthorized access.
- Getting Started
- Features
- Technologies Used
- Project Structure
- Security
- Exception Handling
- Entity Relationship Diagram
- Java 21 or higher
- Maven
- PostgreSQL
-
Clone the repository:
git clone https://github.com/Kudoo39/integrify-java-inventory-service cd integrify-java-inventory-service -
Configure the
application.propertiesfile in thesrc/main/resourcesdirectory with your database settings. -
Run the application (ensure your database is running before starting the application)
The following endpoints are available in the application:
POST /orders- Create a new orderGET /orders- Retrieve all ordersGET /orders/{id}- Retrieve a specific order by IDPUT /orders/{id}- Update an orderDELETE /orders/{id}- Cancel an order
POST /stocks- Create a new stock entryGET /stocks- Retrieve all stock entriesGET /stocks/{id}- Retrieve a specific stock entry by IDPUT /stocks/{id}- Update stock informationDELETE /stocks/{id}- Delete an stock entryGET /stocks/supplier/{supplierId}- Retrieve all stock entries by supplier IDGET /stocks/product/{productId}- Retrieve a specific stock entry by product IDGET /stocks/lowstock- Retrieve all stock entries which are low
POST /suppliers- Create a new supplierGET /suppliers- Retrieve all suppliersGET /suppliers/{id}- Retrieve a specific supplier by IDPUT /suppliers/{id}- Update supplier informationDELETE /suppliers/{id}- Delete a supplier
- Automated daily reports for inventory and sales.
- Java
- Spring Boot
- Spring Security
- JPA
- Maven
- PostgreSQL
src
┣ main
┃ ┣ java
┃ ┃ ┗ com
┃ ┃ ┃ ┗ example
┃ ┃ ┃ ┃ ┣ application
┃ ┃ ┃ ┃ ┃ ┣ dtos
┃ ┃ ┃ ┃ ┃ ┃ ┣ orderDto
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderCreateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderReadDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderUpdateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ orderItemDto
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderItemCreateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderItemReadDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderItemUpdateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ stockDto
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ StockCreateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ StockReadDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ StockUpdateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ supplierDto
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ SupplierCreateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ SupplierReadDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ SupplierUpdateDto.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderItemMapper.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ OrderMapper.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ StockMapper.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ SupplierMapper.java
┃ ┃ ┃ ┃ ┃ ┣ notification
┃ ┃ ┃ ┃ ┃ ┃ ┗ NotificationService.java
┃ ┃ ┃ ┃ ┃ ┣ order
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderService.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderService.java
┃ ┃ ┃ ┃ ┃ ┣ orderItem
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderItemService.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderItemService.java
┃ ┃ ┃ ┃ ┃ ┣ report
┃ ┃ ┃ ┃ ┃ ┃ ┣ InventoryReport.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ ReportService.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ SalesReport.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ ScheduledTasks.java
┃ ┃ ┃ ┃ ┃ ┣ stock
┃ ┃ ┃ ┃ ┃ ┃ ┣ IStockService.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ LowStockAlertService.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ StockService.java
┃ ┃ ┃ ┃ ┃ ┗ supplier
┃ ┃ ┃ ┃ ┃ ┃ ┣ ISupplierService.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ SupplierService.java
┃ ┃ ┃ ┃ ┣ domain
┃ ┃ ┃ ┃ ┃ ┣ order
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ Order.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderStatus.java
┃ ┃ ┃ ┃ ┃ ┣ orderItem
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderItemRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderItem.java
┃ ┃ ┃ ┃ ┃ ┣ stock
┃ ┃ ┃ ┃ ┃ ┃ ┣ IStockRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ Stock.java
┃ ┃ ┃ ┃ ┃ ┗ supplier
┃ ┃ ┃ ┃ ┃ ┃ ┣ ISupplierRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ Supplier.java
┃ ┃ ┃ ┃ ┣ infrastructure
┃ ┃ ┃ ┃ ┃ ┣ order
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderJpaRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderRepo.java
┃ ┃ ┃ ┃ ┃ ┣ orderItem
┃ ┃ ┃ ┃ ┃ ┃ ┣ IOrderItemJpaRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ OrderItemRepo.java
┃ ┃ ┃ ┃ ┃ ┣ stock
┃ ┃ ┃ ┃ ┃ ┃ ┣ IStockJpaRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ StockRepo.java
┃ ┃ ┃ ┃ ┃ ┗ supplier
┃ ┃ ┃ ┃ ┃ ┃ ┣ ISupplierJpaRepo.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ SupplierRepo.java
┃ ┃ ┃ ┃ ┣ presentation
┃ ┃ ┃ ┃ ┃ ┣ customException
┃ ┃ ┃ ┃ ┃ ┃ ┣ BadRequest.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ Conflict.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ Forbidden.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ OutOfStock.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ ResourceNotFound.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ Unauthorized.java
┃ ┃ ┃ ┃ ┃ ┣ security
┃ ┃ ┃ ┃ ┃ ┃ ┣ ApiKeyFilter.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ JWTService.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ SecurityConfig.java
┃ ┃ ┃ ┃ ┃ ┣ shared
┃ ┃ ┃ ┃ ┃ ┃ ┣ ErrorEntity.java
┃ ┃ ┃ ┃ ┃ ┃ ┣ ErrorResponseEntity.java
┃ ┃ ┃ ┃ ┃ ┃ ┗ GlobalExceptionHandler.java
┃ ┃ ┃ ┃ ┃ ┣ OrderController.java
┃ ┃ ┃ ┃ ┃ ┣ OrderItemController.java
┃ ┃ ┃ ┃ ┃ ┣ StockController.java
┃ ┃ ┃ ┃ ┃ ┗ SupplierController.java
┃ ┃ ┃ ┃ ┗ InventoryServiceApplication.java
┃ ┗ resources
┃ ┃ ┣ static
┃ ┃ ┣ templates
┃ ┃ ┣ application.properties
┃ ┃ ┣ env.properties
┃ ┃ ┣ env.properties.example
┃ ┃ ┣ er_diagram.png
┃ ┃ ┗ logback-spring.xml
┗ test
┃ ┗ java
┃ ┃ ┗ com
┃ ┃ ┃ ┗ example
┃ ┃ ┃ ┃ ┗ inventory_service
┃ ┃ ┃ ┃ ┃ ┗ InventoryServiceApplicationTests.java
The application uses API key-based authentication to restrict unauthorized access to API endpoints.
Configure the API key in the env.properties file: API_KEY=your_api_key
Exceptions are handled centrally using custom exception classes defined in the presentation/customException. These exceptions are then caught and processed in presentation/shared/GlobalExceptionHandler.java.
