E2IP Inventory Management Application
Overview
The E2IP Inventory Management Application is a Spring Boot-based application designed to manage inventory, components, and their associated data. It integrates with external APIs (e.g., DigiKey) and provides endpoints for managing components, suppliers, and inventory stock.
Application Architecture
1. Core Components
- Controllers: Handle HTTP requests and responses.
ComponentController: Manages components and their stock.DigikeyAuthController: Handles integration with DigiKey APIs.AuthController: Manages user authentication and token handling.- Services: Contain the business logic.
ComponentServiceImp: Implements logic for managing components.AuthService: Handles authentication and token management.JsonParsingService: Parses JSON payloads into entities.- Repositories: Provide database access using Spring Data JPA.
ComponentRepository: ManagesComponententity persistence.PackageTypeRepository: ManagesPackageTypeentity persistence.- Other repositories for related entities like
Supplier,Inventory, etc.
2. Entity Relationships
- Component: Represents a product in the inventory.
- Linked to
ComponentType,Description,PackageType, andSupplier. - ProductVariation: Represents variations of a component.
- Supplier: Represents the supplier of a component.
- Inventory: Tracks stock levels and inventory history.
Application Workflow
1. Component Management
- Add Component:
- JSON payload is sent to the
/api/components/addFromJsonendpoint. - The
JsonParsingServiceparses the payload into aComponententity. - The
ComponentServiceImpensures related entities (e.g.,PackageType,Supplier) are created or reused. -
The
Componentis saved to the database. -
Update Local Stock:
-
The
/api/components/updateLocalStockendpoint updates thelocalStockandminLocalStockof a component. -
Checkout Component:
- The
/api/components/checkoutComponentendpoint reduces thelocalStockby a specified amount.
2. DigiKey Integration
- Category Retrieval:
- The
/digikey/auth/categoriesendpoint fetches categories from the DigiKey API. - Keyword Search:
- The
/digikey/auth/keywordSearchendpoint searches for components using keywords.
3. Authentication
- User Login:
- The
AuthControllerhandles user login and token generation. - Token Refresh:
- Tokens are refreshed automatically when expired using the
RefreshTokenService.
Key Features
- Component Management: Add, update, and manage components and their stock.
- DigiKey API Integration: Fetch categories and search for components.
- Authentication: Secure endpoints with JWT-based authentication.
- Database Management: Use Spring Data JPA for entity persistence.
How to Run the Application
Prerequisites
- Java 17+
- Maven
- PostgreSQL (or your configured database)
Steps
- Clone the repository:
bash git clone <repository-url> cd e2ip_inventory_app - Configure the database in
application.yml. - Build the application:
bash mvn clean install - Run the application:
bash mvn spring-boot:run
Future Enhancements
- Add unit tests for all services and controllers.
- Improve error handling and logging.
- Implement a frontend for better user interaction.
Contributors
- Wassim: Lead Developer
License
This project is licensed under the MIT License.