Skip to content

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: Manages Component entity persistence.
  • PackageTypeRepository: Manages PackageType entity 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, and Supplier.
  • 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/addFromJson endpoint.
  • The JsonParsingService parses the payload into a Component entity.
  • The ComponentServiceImp ensures related entities (e.g., PackageType, Supplier) are created or reused.
  • The Component is saved to the database.

  • Update Local Stock:

  • The /api/components/updateLocalStock endpoint updates the localStock and minLocalStock of a component.

  • Checkout Component:

  • The /api/components/checkoutComponent endpoint reduces the localStock by a specified amount.

2. DigiKey Integration

  • Category Retrieval:
  • The /digikey/auth/categories endpoint fetches categories from the DigiKey API.
  • Keyword Search:
  • The /digikey/auth/keywordSearch endpoint searches for components using keywords.

3. Authentication

  • User Login:
  • The AuthController handles 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

  1. Clone the repository: bash git clone <repository-url> cd e2ip_inventory_app
  2. Configure the database in application.yml.
  3. Build the application: bash mvn clean install
  4. 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.