Abhinav - feat(ki-inventory): add stats endpoint and DB seed script#2166
Abhinav - feat(ki-inventory): add stats endpoint and DB seed script#2166abhinav-TB wants to merge 2 commits into
Conversation
|
Radia731
left a comment
There was a problem hiding this comment.
Hello!
Checked out the feature/ki-inventory-api-connect branch, ran npm install, and successfully executed the seed script (node src/scripts/seedKIInventoryItems.js) to populate the local database.
Started the backend server with npm run dev and tested the new inventory endpoint via Postman. Here are the results (screenshots attached below):
GET (Inventory Stats): Hit the /api/kitchenandinventory/inventory/items/stats endpoint and verified it returned a successful response containing the expected object detailing totalItems, criticalStock, and lowStock. ✅
Summary - This PR is approved and ready for Jae to merge




Description
Implements # Kitchen Inventory - API Connectivity
Related PRs (if any):
Frontend branch:
feature/ki-inventory-api-connectOneCommunityGlobal/HighestGoodNetworkApp#5142
Main changes explained:
src/scripts/seedKIInventoryItems.js— Script to seed the local MongoDB with sample inventory data (equipment, ingredients, seeds, etc.) and calculate expiration dates for testing preserved items logic.src/controllers/kitchenandinventory/KIInventoryController.js— Added thegetInventoryStatsfunction to query the database and calculate total items, critical stock count, and low stock count based on current vs target thresholds.src/routes/kitchenandinventory/KIInventoryRouter.js— Exposed theGET /inventory/items/statsroute for the frontend to consume.How to test:
feature/ki-inventory-api-connectin theHGNRestrepository.npm installnode src/scripts/seedKIInventoryItems.jsnpm run devto start the backend server.GET http://localhost:4500/api/kitchenandinventory/inventory/items/statsin Postman.totalItems,criticalStock, andlowStock.Screenshots or videos of changes:
Note: