Abhinav kitchen inventory management create database models and backend api endpoints for transplanting and harvesting events#2097
Open
Conversation
Backend Release to Main [2.82]
Backend Release to Main [2.83]
… routes for Kitchen Inventory Management
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Description
This PR implements the backend database models and API endpoints for transplanting and harvesting garden events for the Kitchen Inventory Management module. These events help track transplanting activities and harvest yields across Garden, Orchard, and Animal modules.
Implements # (WBS) Kitchen Inventory Management - Create database models and backend API endpoints for transplanting and harvesting events
Related PRS (if any):
None
Main changes explained:
Created transplantingEvent model with fields: name, related_to, date, position_from, position_to.
Created harvestingEvent model with fields: name, related_to, type (garden harvesting | orchard harvesting), expected_date, yield.
Implemented transplantingController with POST and GET endpoints including input validation.
Implemented harvestingController with POST and GET endpoints, including filtering harvest events by type via query parameter.
Created transplantingRouter to define API routes for transplanting events.
Created harvestingRouter to define API routes for harvesting events.
Updated routes.js to register new routes under /api/kitchenandinventory/.
How to test:
Check into current branch
Run npm install and npm run dev to run this PR locally
Clear site data/cache
Test Transplanting POST: POST to /api/kitchenandinventory/transplanting with body:
json
{ "name": "Tomato Seedling", "related_to": "Garden", "date": "2026-03-15", "position_from": "Bed A", "position_to": "Bed C" }
Verify 201 response with the created event.
Test Transplanting GET: GET /api/kitchenandinventory/transplanting — verify all events returned sorted by date.
Test Harvesting POST: POST to /api/kitchenandinventory/harvesting with body:
json
{ "name": "Carrot Harvest", "related_to": "Garden", "type": "garden harvesting", "expected_date": "2026-04-01", "yield": 50 }
Verify 201 response with the created event.
Test Harvesting GET (all): GET /api/kitchenandinventory/harvesting — verify all events returned.
Test Harvesting GET (by type): GET /api/kitchenandinventory/harvesting?type=garden%20harvesting — verify only garden harvesting events returned.
Test validation: Send requests with missing required fields and invalid related_to or type values — verify 400 error responses.
Screenshots or videos of changes:
Screen.Recording.2026-03-11.at.4.10.54.PM.mov