Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete Inventory Management Module Implementation #929

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

IkkiOcean
Copy link
Contributor

Description:

This PR implements the Inventory Management module, which includes schema definitions and controllers for managing product stock, inventory across different warehouses, and automatic reorder processes when stock levels fall below predefined thresholds. Key features and functionalities include:

  1. Inventory Schema:

    • productId: Reference to the Product collection to associate each inventory item with a product.
    • currentStockLevel: Integer to track the current quantity of the product in stock.
    • reorderLevel: Minimum threshold for each product, below which an automatic reorder or alert is triggered.
    • lastRestockedDate: Date field to track the last restocking event.
    • warehouseLocation: Tracks which warehouse the product is stored in.
    • supplierId: (Optional) Reference to the Supplier schema for product sourcing.
    • performedBy: Stores the user responsible for the inventory update or action.
  2. Controllers Implemented:

    • Create Inventory Item: Allows the creation of a new inventory entry, associating it with a product and a warehouse.
    • Update Stock Level: Provides functionality to manually update the stock level when new stock is added or removed.
    • Fetch Inventory by Product: Retrieves inventory details for a specific product, including stock level, location, and associated supplier.
    • Fetch Inventory by Warehouse: Allows querying inventory details by warehouse location.
    • Bulk Create Inventory Items: Supports creating multiple inventory items in bulk.
    • Bulk Update Stock Levels: Allows updating the stock levels of multiple inventory items at once.
    • Reorder Level Check: Implements logic to automatically check stock levels against the reorder threshold.
    • Low Stock Alerts: Triggers an alert or notification when stock levels fall below the reorder level, logging it for future reference.
    • Expired Inventory Handling: Detects and handles expired or outdated inventory based on predefined rules.
    • Log Inventory Actions: Tracks and logs all changes made to the inventory, including stock updates, reorder events, and restocking actions.
  3. Middleware:

    • Validation Middleware: Ensures that stock levels cannot be negative, validates the existence of products before creating inventory entries, and performs checks before updating stock levels.
    • Error Handling Middleware: Handles errors effectively, providing clear feedback for failed operations, such as invalid product IDs or nonexistent inventory entries.
  4. Business Logic:

    • Automatic Reorder Process: If stock levels drop below the reorder threshold, a reorder request is generated or an alert is triggered for the responsible personnel.
    • Inventory Expiry Logic: Automatic checks are in place for inventory that has reached or exceeded its shelf life, preventing the system from continuing to process expired stock.
  5. Validation & Error Handling:

    • The module ensures that no inventory entries are created with negative stock levels.
    • It checks that the associated product exists in the system before creating or updating an inventory item.
    • If an operation fails, clear and detailed error messages are returned to help users and admins understand and resolve the issue.

Related Issues:

Copy link

vercel bot commented Nov 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agro-tech-ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 9, 2024 1:38pm

Copy link
Contributor

github-actions bot commented Nov 9, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@manikumarreddyu manikumarreddyu merged commit 779c61f into manikumarreddyu:main Nov 9, 2024
4 checks passed
Copy link
Contributor

github-actions bot commented Nov 9, 2024

🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Schema and Controllers for Inventory Management
2 participants