Skip to content

Abhinav kitchen inventory management create database models and backend api endpoints for transplanting and harvesting events#2097

Open
abhinav-TB wants to merge 3 commits intodevelopmentfrom
Abhinav-Kitchen-Inventory-Management-Create-database-models-and-backend-API-endpoints-for-transplanting-and-harvesting-events
Open

Abhinav kitchen inventory management create database models and backend api endpoints for transplanting and harvesting events#2097
abhinav-TB wants to merge 3 commits intodevelopmentfrom
Abhinav-Kitchen-Inventory-Management-Create-database-models-and-backend-API-endpoints-for-transplanting-and-harvesting-events

Conversation

@abhinav-TB
Copy link
Copy Markdown
Member

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

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants